terry-li-hm
commited on
Commit
·
fa5f528
1
Parent(s):
2663e90
Update
Browse files
app.py
CHANGED
@@ -35,43 +35,43 @@ def model_inference(input_wav, language):
|
|
35 |
|
36 |
def launch():
|
37 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
38 |
-
|
39 |
with gr.Row():
|
40 |
with gr.Column(scale=2):
|
41 |
-
|
42 |
-
audio_inputs = gr.Audio(
|
43 |
-
# label="Upload audio or use the microphone"
|
44 |
-
)
|
45 |
-
# Commented out language dropdown and set default to "yue"
|
46 |
# language_inputs = gr.Dropdown(
|
47 |
# choices=["auto", "zh", "en", "yue", "ja", "ko", "nospeech"],
|
48 |
# value="auto",
|
49 |
# label="Language",
|
50 |
# )
|
51 |
-
language_inputs = "yue" # Set default language to "yue"
|
52 |
fn_button = gr.Button("Process Audio", variant="primary")
|
53 |
|
54 |
with gr.Column(scale=3):
|
55 |
-
|
56 |
-
text_outputs = gr.Textbox(
|
57 |
-
# label="Output",
|
58 |
-
lines=10
|
59 |
-
)
|
60 |
|
61 |
with gr.Row():
|
62 |
-
# gr.Markdown("## Examples")
|
63 |
gr.Examples(
|
64 |
-
examples=[["example/scb.mp3", "yue"
|
65 |
-
inputs=[audio_inputs,
|
66 |
outputs=text_outputs,
|
67 |
-
fn=model_inference,
|
68 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
fn_button.click(
|
71 |
-
model_inference,
|
72 |
-
inputs=[audio_inputs
|
73 |
outputs=text_outputs,
|
74 |
)
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
demo.launch()
|
77 |
|
|
|
35 |
|
36 |
def launch():
|
37 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
38 |
with gr.Row():
|
39 |
with gr.Column(scale=2):
|
40 |
+
audio_inputs = gr.Audio()
|
|
|
|
|
|
|
|
|
41 |
# language_inputs = gr.Dropdown(
|
42 |
# choices=["auto", "zh", "en", "yue", "ja", "ko", "nospeech"],
|
43 |
# value="auto",
|
44 |
# label="Language",
|
45 |
# )
|
|
|
46 |
fn_button = gr.Button("Process Audio", variant="primary")
|
47 |
|
48 |
with gr.Column(scale=3):
|
49 |
+
text_outputs = gr.Textbox(lines=10)
|
|
|
|
|
|
|
|
|
50 |
|
51 |
with gr.Row():
|
|
|
52 |
gr.Examples(
|
53 |
+
examples=[["example/scb.mp3"]], # Remove "yue" from here
|
54 |
+
inputs=[audio_inputs], # Only pass audio_inputs
|
55 |
outputs=text_outputs,
|
56 |
+
fn=lambda x: model_inference(x, "yue"), # Always use "yue" as language
|
57 |
)
|
58 |
+
# gr.Examples(
|
59 |
+
# examples=[["example/scb.mp3", "yue"]],
|
60 |
+
# inputs=[audio_inputs, language_inputs],
|
61 |
+
# outputs=text_outputs,
|
62 |
+
# fn=model_inference,
|
63 |
+
# )
|
64 |
|
65 |
fn_button.click(
|
66 |
+
lambda x: model_inference(x, "yue"), # Always use "yue" as language
|
67 |
+
inputs=[audio_inputs],
|
68 |
outputs=text_outputs,
|
69 |
)
|
70 |
+
# fn_button.click(
|
71 |
+
# model_inference,
|
72 |
+
# inputs=[audio_inputs, language_inputs],
|
73 |
+
# outputs=text_outputs,
|
74 |
+
# )
|
75 |
|
76 |
demo.launch()
|
77 |
|