refac: audio upload handling

This commit is contained in:
Timothy Jaeryang Baek
2025-05-19 02:52:48 +04:00
parent aee9d05916
commit 73e64fe7fb
2 changed files with 41 additions and 46 deletions
+3 -10
View File
@@ -140,16 +140,9 @@ def upload_file(
if process:
try:
if file.content_type:
if file.content_type.startswith(
(
"audio/mpeg",
"audio/wav",
"audio/ogg",
"audio/x-m4a",
"audio/webm",
"video/webm",
)
):
if file.content_type.startswith("audio/") or file.content_type in {
"video/webm"
}:
file_path = Storage.get_file(file_path)
result = transcribe(request, file_path)