Spaces:
Sleeping
Sleeping
Download ui/src/lib/api.ts from charlesyapai/hcc-meat-coder: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/charlesyapai/hcc-meat-coder/resolve/main/ui/src/lib/api.ts
- Command line
-
hf download hf://spaces/charlesyapai/hcc-meat-coder/ui/src/lib/api.ts
-
curl -L -o api.ts https://huggingface.co/spaces/charlesyapai/hcc-meat-coder/resolve/main/ui/src/lib/api.ts
1.25 kB
| import type { CodingResult, GalleryItem } from "./types"; | |
| const JSON_HEADERS = { "Content-Type": "application/json" }; | |
| export async function codeNote(text: string, noteId = "adhoc"): Promise<CodingResult> { | |
| const res = await fetch("/api/code", { | |
| method: "POST", | |
| headers: JSON_HEADERS, | |
| body: JSON.stringify({ text, note_id: noteId }), | |
| }); | |
| if (!res.ok) throw new Error(`API error: ${res.status} ${await res.text()}`); | |
| return res.json(); | |
| } | |
| export async function fetchGallery(): Promise<GalleryItem[]> { | |
| const res = await fetch("/api/gallery"); | |
| if (!res.ok) throw new Error(`Gallery fetch failed: ${res.status}`); | |
| return res.json(); | |
| } | |
| export interface ServerStatus { | |
| status: "ok" | "degraded"; | |
| version: string; | |
| pipeline_ready: boolean; | |
| reference_counts: { | |
| hcc_labels?: number; | |
| hcc_crosswalk_icd10?: number; | |
| }; | |
| gallery_size: number; | |
| metrics_available: boolean; | |
| meat_llm_configured?: boolean; | |
| meat_llm_model?: string | null; | |
| meat_llm_ready?: boolean | null; | |
| startup_errors?: Record<string, string>; | |
| } | |
| export async function fetchStatus(): Promise<ServerStatus> { | |
| const res = await fetch("/api/status"); | |
| if (!res.ok) throw new Error(`Status fetch failed: ${res.status}`); | |
| return res.json(); | |
| } | |