Skip to content

Commit c5d4c15

Browse files
lemiskyaiwantaozi
authored andcommitted
feat(stt): Enhance audio format compatibility with filename fallback
1 parent 48105ba commit c5d4c15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vox_box/server/routers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import functools
3+
import mimetypes
34
from fastapi import APIRouter, HTTPException, Request, UploadFile
45
from pydantic import BaseModel
56
from fastapi.responses import FileResponse
@@ -120,7 +121,7 @@ async def transcribe(request: Request):
120121
file: UploadFile = form[
121122
"file"
122123
] # flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm
123-
file_content_type = file.content_type
124+
file_content_type = file.content_type or mimetypes.guess_type(file.filename)[0]
124125
if file_content_type not in ALLOWED_TRANSCRIPTIONS_INPUT_AUDIO_FORMATS:
125126
return HTTPException(
126127
status_code=400,

0 commit comments

Comments
 (0)