Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,10 @@ mms_mic_source_trans = gr.Audio(source="microphone", type="filepath", label="Use
|
|
16 |
mms_upload_source_trans = gr.Audio(
|
17 |
source="upload", type="filepath", label="Upload file", visible=False
|
18 |
)
|
|
|
|
|
|
|
|
|
19 |
mms_transcribe = gr.Interface(
|
20 |
fn=transcribe,
|
21 |
inputs=[
|
@@ -25,13 +29,13 @@ mms_transcribe = gr.Interface(
|
|
25 |
gr.Dropdown(
|
26 |
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
|
27 |
label="Language",
|
28 |
-
value="
|
29 |
),
|
30 |
# gr.Checkbox(label="Use Language Model (if available)", default=True),
|
31 |
],
|
32 |
outputs="text",
|
33 |
examples=ASR_EXAMPLES,
|
34 |
-
title="
|
35 |
description=(
|
36 |
"Transcribe audio from a microphone or input file in your desired language."
|
37 |
),
|
@@ -39,14 +43,17 @@ mms_transcribe = gr.Interface(
|
|
39 |
allow_flagging="never",
|
40 |
)
|
41 |
|
|
|
|
|
|
|
42 |
mms_synthesize = gr.Interface(
|
43 |
fn=synthesize,
|
44 |
inputs=[
|
45 |
-
gr.Text(label="
|
46 |
gr.Dropdown(
|
47 |
[f"{k} ({v})" for k, v in TTS_LANGUAGES.items()],
|
48 |
-
label="
|
49 |
-
value="fao
|
50 |
),
|
51 |
gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Speed"),
|
52 |
],
|
@@ -78,14 +85,14 @@ mms_identify = gr.Interface(
|
|
78 |
],
|
79 |
outputs=gr.Label(num_top_classes=10),
|
80 |
examples=LID_EXAMPLES,
|
81 |
-
title="
|
82 |
description=("Identity the language of input audio."),
|
83 |
allow_flagging="never",
|
84 |
)
|
85 |
|
86 |
tabbed_interface = gr.TabbedInterface(
|
87 |
[mms_transcribe, mms_synthesize, mms_identify],
|
88 |
-
["
|
89 |
)
|
90 |
|
91 |
with gr.Blocks() as demo:
|
|
|
16 |
mms_upload_source_trans = gr.Audio(
|
17 |
source="upload", type="filepath", label="Upload file", visible=False
|
18 |
)
|
19 |
+
|
20 |
+
# Filter ASR_LANGUAGES to only include Faroese
|
21 |
+
ASR_LANGUAGES = {'fao': 'Faroese'}
|
22 |
+
|
23 |
mms_transcribe = gr.Interface(
|
24 |
fn=transcribe,
|
25 |
inputs=[
|
|
|
29 |
gr.Dropdown(
|
30 |
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
|
31 |
label="Language",
|
32 |
+
value="fao (Faroese)",
|
33 |
),
|
34 |
# gr.Checkbox(label="Use Language Model (if available)", default=True),
|
35 |
],
|
36 |
outputs="text",
|
37 |
examples=ASR_EXAMPLES,
|
38 |
+
title="Speech-to-text",
|
39 |
description=(
|
40 |
"Transcribe audio from a microphone or input file in your desired language."
|
41 |
),
|
|
|
43 |
allow_flagging="never",
|
44 |
)
|
45 |
|
46 |
+
# Filter TTS_LANGUAGES to only include Faroese
|
47 |
+
TTS_LANGUAGES = {'fao': 'Faroese'}
|
48 |
+
|
49 |
mms_synthesize = gr.Interface(
|
50 |
fn=synthesize,
|
51 |
inputs=[
|
52 |
+
gr.Text(label="Input Text"),
|
53 |
gr.Dropdown(
|
54 |
[f"{k} ({v})" for k, v in TTS_LANGUAGES.items()],
|
55 |
+
label="Language",
|
56 |
+
value="fao (Faroese)",
|
57 |
),
|
58 |
gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Speed"),
|
59 |
],
|
|
|
85 |
],
|
86 |
outputs=gr.Label(num_top_classes=10),
|
87 |
examples=LID_EXAMPLES,
|
88 |
+
title="Language Identification",
|
89 |
description=("Identity the language of input audio."),
|
90 |
allow_flagging="never",
|
91 |
)
|
92 |
|
93 |
tabbed_interface = gr.TabbedInterface(
|
94 |
[mms_transcribe, mms_synthesize, mms_identify],
|
95 |
+
["Speech-to-text", "Text-to-speech", "Language Identification"],
|
96 |
)
|
97 |
|
98 |
with gr.Blocks() as demo:
|