Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,9 +14,7 @@ def transcribe_audio(audio):
|
|
| 14 |
|
| 15 |
try:
|
| 16 |
# Recognize the audio using Google Web Speech API
|
| 17 |
-
print("Transcribing the audio...")
|
| 18 |
transcription = recognizer.recognize_google(audio_data)
|
| 19 |
-
print("Transcription completed.")
|
| 20 |
return transcription
|
| 21 |
except sr.UnknownValueError:
|
| 22 |
return "Google Speech Recognition could not understand the audio"
|
|
@@ -70,12 +68,12 @@ def gradio_function(paragraph, audio):
|
|
| 70 |
# Return comparison result
|
| 71 |
return comparison_result
|
| 72 |
|
| 73 |
-
# Gradio Interface
|
| 74 |
interface = gr.Interface(
|
| 75 |
fn=gradio_function,
|
| 76 |
inputs=[
|
| 77 |
-
gr.
|
| 78 |
-
gr.
|
| 79 |
],
|
| 80 |
outputs="json",
|
| 81 |
title="Speech Recognition Comparison",
|
|
|
|
| 14 |
|
| 15 |
try:
|
| 16 |
# Recognize the audio using Google Web Speech API
|
|
|
|
| 17 |
transcription = recognizer.recognize_google(audio_data)
|
|
|
|
| 18 |
return transcription
|
| 19 |
except sr.UnknownValueError:
|
| 20 |
return "Google Speech Recognition could not understand the audio"
|
|
|
|
| 68 |
# Return comparison result
|
| 69 |
return comparison_result
|
| 70 |
|
| 71 |
+
# Gradio Interface using the updated API
|
| 72 |
interface = gr.Interface(
|
| 73 |
fn=gradio_function,
|
| 74 |
inputs=[
|
| 75 |
+
gr.Textbox(lines=5, label="Input Paragraph"),
|
| 76 |
+
gr.Audio(source="microphone", type="file", label="Record Audio")
|
| 77 |
],
|
| 78 |
outputs="json",
|
| 79 |
title="Speech Recognition Comparison",
|