Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,15 +9,32 @@ def transcribe(audio):
|
|
9 |
generated_text = pipe2(text, max_length=50, num_return_sequences=2)[0]['generated_text']
|
10 |
return text, generated_text
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
gr.
|
17 |
-
gr.
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
generated_text = pipe2(text, max_length=50, num_return_sequences=2)[0]['generated_text']
|
10 |
return text, generated_text
|
11 |
|
12 |
+
with gr.Blocks() as demo:
|
13 |
+
gr.Markdown("Whisper Small Swedish + Swedish GPT")
|
14 |
+
gr.Markdown("Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model & text generation with Swedish GPT.")
|
15 |
+
with gr.TabItem("Upload from disk"):
|
16 |
+
upload_file = gr.Audio(source="upload", type="filepath",label="Upload from disk")
|
17 |
+
upload_button = gr.Button("Submit for recognition")
|
18 |
+
upload_outputs = [
|
19 |
+
gr.Textbox(label="Recognized speech from uploaded file"),
|
20 |
+
gr.Textbox(label="Swedish-gpt generated speech from uploaded file")
|
21 |
+
]
|
22 |
+
with gr.TabItem("Record from microphone"):
|
23 |
+
record_file = gr.Audio(source="microphone", type="filepath",label="Record from microphone")
|
24 |
+
record_button = gr.Button("Submit for recognition")
|
25 |
+
record_outputs = [
|
26 |
+
gr.Textbox(label="Recognized speech from recordings"),
|
27 |
+
gr.Textbox(label="Swedish-gpt generated speech from recordings")
|
28 |
+
]
|
29 |
+
upload_button.click(
|
30 |
+
fn=transcribe,
|
31 |
+
inputs=upload_file,
|
32 |
+
outputs=upload_outputs,
|
33 |
+
)
|
34 |
+
record_button.click(
|
35 |
+
fn=transcribe,
|
36 |
+
inputs=record_file,
|
37 |
+
outputs=record_outputs,
|
38 |
+
)
|
39 |
+
|
40 |
+
demo.launch()
|