Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,34 +1,23 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import
|
| 3 |
-
from asr import transcribe, ASR_EXAMPLES, ASR_LANGUAGES, ASR_NOTE
|
| 4 |
|
| 5 |
# Speech-to-Text Interface
|
| 6 |
mms_transcribe = gr.Interface(
|
| 7 |
-
fn=
|
| 8 |
-
inputs=
|
| 9 |
-
gr.Audio(),
|
| 10 |
-
gr.Dropdown(
|
| 11 |
-
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
|
| 12 |
-
label="Language",
|
| 13 |
-
value="eng English",
|
| 14 |
-
),
|
| 15 |
-
],
|
| 16 |
outputs="text",
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
description="Transcribe audio from a microphone or input file in your desired language.",
|
| 20 |
-
article=ASR_NOTE,
|
| 21 |
allow_flagging="never",
|
| 22 |
)
|
| 23 |
|
| 24 |
# Main Gradio App
|
| 25 |
with gr.Blocks() as demo:
|
| 26 |
gr.Markdown("<p align='center' style='font-size: 20px;'>MMS Speech-to-Text</p>")
|
| 27 |
-
gr.HTML("<center>
|
| 28 |
|
| 29 |
mms_transcribe.render()
|
| 30 |
|
| 31 |
if __name__ == "__main__":
|
| 32 |
demo.queue()
|
| 33 |
demo.launch()
|
| 34 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from asr import transcribe_auto # Import the updated function
|
|
|
|
| 3 |
|
| 4 |
# Speech-to-Text Interface
|
| 5 |
mms_transcribe = gr.Interface(
|
| 6 |
+
fn=transcribe_auto,
|
| 7 |
+
inputs=gr.Audio(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
outputs="text",
|
| 9 |
+
title="Multilingual Speech-to-Text",
|
| 10 |
+
description="Automatically detects and transcribes English or Swahili speech.",
|
|
|
|
|
|
|
| 11 |
allow_flagging="never",
|
| 12 |
)
|
| 13 |
|
| 14 |
# Main Gradio App
|
| 15 |
with gr.Blocks() as demo:
|
| 16 |
gr.Markdown("<p align='center' style='font-size: 20px;'>MMS Speech-to-Text</p>")
|
| 17 |
+
gr.HTML("<center>Upload or record audio. The model will automatically detect the language (English or Swahili) and transcribe.</center>")
|
| 18 |
|
| 19 |
mms_transcribe.render()
|
| 20 |
|
| 21 |
if __name__ == "__main__":
|
| 22 |
demo.queue()
|
| 23 |
demo.launch()
|
|
|