Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import speech_recognition as sr
|
| 3 |
|
| 4 |
-
def transcribe_audio(
|
| 5 |
recognizer = sr.Recognizer()
|
| 6 |
-
|
| 7 |
-
#
|
| 8 |
-
if
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
# Load the audio file
|
| 12 |
with sr.AudioFile(audio_file_path) as source:
|
| 13 |
audio_data = recognizer.record(source)
|
|
@@ -31,4 +33,4 @@ iface = gr.Interface(
|
|
| 31 |
)
|
| 32 |
|
| 33 |
# Launch the interface
|
| 34 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import speech_recognition as sr
|
| 3 |
|
| 4 |
+
def transcribe_audio(audio_input):
|
| 5 |
recognizer = sr.Recognizer()
|
| 6 |
+
|
| 7 |
+
# Extract the file path from the Gradio audio input
|
| 8 |
+
if isinstance(audio_input, tuple):
|
| 9 |
+
audio_file_path = audio_input[0]
|
| 10 |
+
else:
|
| 11 |
+
raise ValueError("Expected audio_input to be a tuple, got {}".format(type(audio_input)))
|
| 12 |
+
|
| 13 |
# Load the audio file
|
| 14 |
with sr.AudioFile(audio_file_path) as source:
|
| 15 |
audio_data = recognizer.record(source)
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
# Launch the interface
|
| 36 |
+
iface.launch()
|