File size: 574 Bytes
660e352 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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" }),
);
|