Spaces:
Sleeping
Sleeping
Download api/models.ts from PITTI/speechmap-judges: direct link, hf CLI and curl.
- Browser
- Download file 579 Bytes
-
https://huggingface.co/spaces/PITTI/speechmap-judges/resolve/main/api/models.ts
- Command line
-
hf download hf://spaces/PITTI/speechmap-judges/api/models.ts
-
curl -L -o models.ts https://huggingface.co/spaces/PITTI/speechmap-judges/resolve/main/api/models.ts
579 Bytes
| import type { IncomingMessage, ServerResponse } from 'http'; | |
| import db from '../src/lib/db.js'; | |
| import type { Model } from '../src/types.js'; | |
| import { jsonResponse } from './utils.js'; | |
| export default async function handler(_req: IncomingMessage, res: ServerResponse) { | |
| try { | |
| const sql = 'SELECT DISTINCT model FROM responses ORDER BY model ASC'; | |
| const models = await db.query<Model>(sql); | |
| jsonResponse(res, 200, models); | |
| } catch (error) { | |
| console.error('Failed to fetch models:', error); | |
| jsonResponse(res, 500, { error: 'Failed to fetch models' }); | |
| } | |
| } |