Spaces:
Running

attention / frontends /react /src /python.ts
nhamid289's picture
Deploy from elvis-code (redesigned with the ELVIS design system)
660e352 verified
Raw History Blame Contribute Delete
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" }),
);