Spaces:
Running
Running
Download frontends/react/src/python.ts from nhamid289/autodiff-dev: direct link, hf CLI and curl.
- Browser
- Download file 644 Bytes
-
https://huggingface.co/spaces/nhamid289/autodiff-dev/resolve/main/frontends/react/src/python.ts
- Command line
-
hf download hf://spaces/nhamid289/autodiff-dev/frontends/react/src/python.ts
-
curl -L -o python.ts https://huggingface.co/spaces/nhamid289/autodiff-dev/resolve/main/frontends/react/src/python.ts
644 Bytes
| import { createPython } from "@elvis/pyodide"; | |
| import type { Graph, Mode, State } from "./types"; | |
| // The methods of backend/src/manager.py's Manager | |
| export type AutodiffApi = { | |
| handle_set_function: { args: { expression: string }; result: Graph }; | |
| // seed is needed in forward mode | |
| handle_set_run: { args: { mode: Mode; inputs: Record<string, number>; seed?: string }; result: { steps: number } }; | |
| // null past the last step | |
| handle_state: { args: { iteration: number }; result: State | null }; | |
| }; | |
| export const python = createPython<AutodiffApi>( | |
| new Worker(new URL("./pyodide.worker.ts", import.meta.url), { type: "module" }), | |
| ); | |