Update app.py
Browse files
app.py
CHANGED
@@ -22,15 +22,12 @@ def s2t(audio, model_name):
|
|
22 |
yield text
|
23 |
|
24 |
with gr.Blocks() as demo:
|
25 |
-
with gr.
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
model_name = gr.Dropdown(
|
32 |
-
label="Models:",
|
33 |
-
choices=[
|
34 |
"openai/whisper-large-v3",
|
35 |
"openai/whisper-large-v2",
|
36 |
"openai/whisper-large",
|
@@ -39,9 +36,12 @@ with gr.Blocks() as demo:
|
|
39 |
"openai/whisper-base",
|
40 |
"openai/whisper-tiny",
|
41 |
],
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
46 |
|
47 |
demo.queue().launch(max_threads=4)
|
|
|
22 |
yield text
|
23 |
|
24 |
with gr.Blocks() as demo:
|
25 |
+
with gr.Column():
|
26 |
+
voice = gr.Audio(sources=["microphone"], type="filepath", label="Voice")
|
27 |
+
audio = gr.Audio(sources=["upload"], type="filepath", label="Audio file")
|
28 |
+
model_name = gr.Dropdown(
|
29 |
+
label="Models:",
|
30 |
+
choices=[
|
|
|
|
|
|
|
31 |
"openai/whisper-large-v3",
|
32 |
"openai/whisper-large-v2",
|
33 |
"openai/whisper-large",
|
|
|
36 |
"openai/whisper-base",
|
37 |
"openai/whisper-tiny",
|
38 |
],
|
39 |
+
value="openai/whisper-large-v3",
|
40 |
+
)
|
41 |
+
with gr.Column():
|
42 |
+
output = gr.Textbox(label="Transcription results")
|
43 |
+
|
44 |
+
voice.stop_recording(s2t, inputs=[voice, model_name], outputs=output)
|
45 |
+
audio.upload(s2t, inputs=[audio, model_name], outputs=output)
|
46 |
|
47 |
demo.queue().launch(max_threads=4)
|