Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,23 @@
|
|
1 |
-
import spaces
|
2 |
import gradio as gr
|
3 |
-
|
4 |
from audio_processing import process_audio
|
5 |
-
|
6 |
|
7 |
@spaces.GPU
|
8 |
def gradio_process_audio(audio):
|
9 |
try:
|
10 |
if audio is None:
|
11 |
return "No file uploaded", "", ""
|
12 |
-
|
13 |
-
#
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
detected_lang, transcription, translation = process_audio((sample_rate, audio_data))
|
18 |
-
|
19 |
return detected_lang, transcription, translation
|
20 |
except Exception as e:
|
|
|
21 |
return str(e), "", ""
|
22 |
|
|
|
23 |
iface = gr.Interface(
|
24 |
fn=gradio_process_audio,
|
25 |
inputs=gr.Audio(type="numpy"),
|
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from audio_processing import process_audio
|
3 |
+
import spaces
|
4 |
|
5 |
@spaces.GPU
|
6 |
def gradio_process_audio(audio):
|
7 |
try:
|
8 |
if audio is None:
|
9 |
return "No file uploaded", "", ""
|
10 |
+
|
11 |
+
# The Gradio Audio input with type="numpy" provides a tuple of (sample_rate, audio_data)
|
12 |
+
# This is exactly what process_audio expects, so we can pass it directly
|
13 |
+
detected_lang, transcription, translation = process_audio(audio)
|
14 |
+
|
|
|
|
|
15 |
return detected_lang, transcription, translation
|
16 |
except Exception as e:
|
17 |
+
print(f"Error in gradio_process_audio: {str(e)}")
|
18 |
return str(e), "", ""
|
19 |
|
20 |
+
|
21 |
iface = gr.Interface(
|
22 |
fn=gradio_process_audio,
|
23 |
inputs=gr.Audio(type="numpy"),
|