Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import gradio as gr # Imports the Gradio library, which is used to create user i
|
|
| 7 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 8 |
API_URL = "https://api-inference.huggingface.co/models/"
|
| 9 |
|
| 10 |
-
def
|
| 11 |
print(f"Filepath: {audio}")
|
| 12 |
with open(audio, "rb") as f:
|
| 13 |
data = f.read()
|
|
@@ -42,7 +42,7 @@ with gr.Blocks() as demo:
|
|
| 42 |
with gr.Column():
|
| 43 |
output = gr.Textbox(label="Transcription results")
|
| 44 |
|
| 45 |
-
audio.stop_recording(
|
| 46 |
-
audio.upload(
|
| 47 |
|
| 48 |
demo.queue().launch()
|
|
|
|
| 7 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 8 |
API_URL = "https://api-inference.huggingface.co/models/"
|
| 9 |
|
| 10 |
+
def s2t(audio, model_name):
|
| 11 |
print(f"Filepath: {audio}")
|
| 12 |
with open(audio, "rb") as f:
|
| 13 |
data = f.read()
|
|
|
|
| 42 |
with gr.Column():
|
| 43 |
output = gr.Textbox(label="Transcription results")
|
| 44 |
|
| 45 |
+
audio.stop_recording(s2t, inputs=[audio, model_name], outputs=[output], concurrency_limit=4)
|
| 46 |
+
audio.upload(s2t, inputs=[audio, model_name], outputs=[output], concurrency_limit=4)
|
| 47 |
|
| 48 |
demo.queue().launch()
|