import { createPython } from "@elvis/pyodide"; import type { ModelResults, Projection } from "@elvis/ui"; import type { DecisionBoundaryResult, DecisionBoundarySettings, ModelSettings } from "./types"; // The methods of backend/src/manager.py's Manager export type DecisionBoundaryApi = { // projection maps plot coordinates back to inputs; omitted when the inputs are the plot coordinates handle_set_dataset: { args: { inputs: number[][]; outputs: string[]; input_names?: string[]; projection?: Projection }; result: null }; handle_set_model_config: { args: ModelSettings; result: null }; // Metrics and learned parameters; null when there is no data to fit handle_build_model: { args: undefined; result: ModelResults | null }; handle_get_decision_boundary: { args: DecisionBoundarySettings; result: DecisionBoundaryResult }; }; export const python = createPython( new Worker(new URL("./pyodide.worker.ts", import.meta.url), { type: "module" }), );