Download src/lib/api/record-lecture.ts from asnannp/DocDoeAI: direct link, hf CLI and curl.
- Browser
- Download file 802 Bytes
-
https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/lib/api/record-lecture.ts
- Command line
-
hf download hf://spaces/asnannp/DocDoeAI/src/lib/api/record-lecture.ts
-
curl -L -o record-lecture.ts https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/lib/api/record-lecture.ts
802 Bytes
| import { apiUpload } from "@/lib/api/client"; | |
| export type TranscriptionResult = { | |
| ok: boolean; | |
| configured: boolean; | |
| transcript: string; | |
| reason: string | null; | |
| duration_seconds: number | null; | |
| }; | |
| /** | |
| * Send a recorded audio clip to the backend for transcription. The backend is | |
| * honest: `configured` is false when the server has no Deepgram key, `ok` is | |
| * true only when real speech was transcribed. Never throws for a "no speech" | |
| * clip — that comes back as ok:false with a reason. | |
| */ | |
| export async function transcribeLecture(audio: Blob, filename = "lecture.webm"): Promise<TranscriptionResult> { | |
| const formData = new FormData(); | |
| formData.append("file", audio, filename); | |
| return apiUpload<TranscriptionResult>("/record-lecture/transcribe", formData, { timeoutMs: 90_000 }); | |
| } | |