Download frontends/react/src/python.ts from elvis-hf/attention: direct link, hf CLI and curl.
- Browser
- Download file 574 Bytes
-
https://huggingface.co/spaces/elvis-hf/attention/resolve/main/frontends/react/src/python.ts
- Command line
-
hf download hf://spaces/elvis-hf/attention/frontends/react/src/python.ts
-
curl -L -o python.ts https://huggingface.co/spaces/elvis-hf/attention/resolve/main/frontends/react/src/python.ts
574 Bytes
| import { createPython } from "@elvis/pyodide"; | |
| import type { Inspection, Language, Translation } from "./types"; | |
| // The methods of backend/src/manager.py's Manager | |
| export type AttentionApi = { | |
| handle_translate: { args: { sentence: string; language: Language }; result: Translation }; | |
| // For the last translation; indices count from 0 | |
| handle_inspect: { args: { layer: number; head: number; row: number }; result: Inspection }; | |
| }; | |
| export const python = createPython<AttentionApi>( | |
| new Worker(new URL("./pyodide.worker.ts", import.meta.url), { type: "module" }), | |
| ); | |