Spaces:
Build error
Build error
Update audio_processing.py
Browse files- audio_processing.py +5 -0
audio_processing.py
CHANGED
@@ -13,6 +13,8 @@ def resample_with_ffmpeg(input_file, output_file, target_sr=16000):
|
|
13 |
]
|
14 |
subprocess.run(command, check=True)
|
15 |
|
|
|
|
|
16 |
def detect_language(audio):
|
17 |
whisper_model = get_whisper_model_small()
|
18 |
|
@@ -46,6 +48,8 @@ def detect_language(audio):
|
|
46 |
|
47 |
return detected_lang
|
48 |
|
|
|
|
|
49 |
def process_long_audio(audio, task="transcribe", language=None):
|
50 |
if audio[0] != SAMPLING_RATE:
|
51 |
# Save the input audio to a file for ffmpeg processing
|
@@ -102,6 +106,7 @@ def process_long_audio(audio, task="transcribe", language=None):
|
|
102 |
return " ".join(results)
|
103 |
|
104 |
|
|
|
105 |
def process_audio(audio):
|
106 |
if audio is None:
|
107 |
return "No file uploaded", "", ""
|
|
|
13 |
]
|
14 |
subprocess.run(command, check=True)
|
15 |
|
16 |
+
|
17 |
+
@spaces.GPU
|
18 |
def detect_language(audio):
|
19 |
whisper_model = get_whisper_model_small()
|
20 |
|
|
|
48 |
|
49 |
return detected_lang
|
50 |
|
51 |
+
|
52 |
+
@spaces.GPU
|
53 |
def process_long_audio(audio, task="transcribe", language=None):
|
54 |
if audio[0] != SAMPLING_RATE:
|
55 |
# Save the input audio to a file for ffmpeg processing
|
|
|
106 |
return " ".join(results)
|
107 |
|
108 |
|
109 |
+
@spaces.GPU
|
110 |
def process_audio(audio):
|
111 |
if audio is None:
|
112 |
return "No file uploaded", "", ""
|