Spaces:
Sleeping
Sleeping
vineelpratap
commited on
Commit
•
2fd6d82
1
Parent(s):
e515ffb
Update app.py
Browse files
app.py
CHANGED
@@ -7,21 +7,12 @@ from lid import identify, LID_EXAMPLES
|
|
7 |
|
8 |
demo = gr.Blocks()
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
label="Audio input",
|
13 |
-
value="Record from Mic",
|
14 |
-
)
|
15 |
-
mms_mic_source_trans = gr.Audio(source="microphone", type="filepath", label="Use mic")
|
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=[
|
22 |
-
|
23 |
-
mms_mic_source_trans,
|
24 |
-
mms_upload_source_trans,
|
25 |
gr.Dropdown(
|
26 |
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
|
27 |
label="Language",
|
@@ -60,21 +51,11 @@ mms_synthesize = gr.Interface(
|
|
60 |
allow_flagging="never",
|
61 |
)
|
62 |
|
63 |
-
|
64 |
-
["Record from Mic", "Upload audio"],
|
65 |
-
label="Audio input",
|
66 |
-
value="Record from Mic",
|
67 |
-
)
|
68 |
-
mms_mic_source_iden = gr.Audio(source="microphone", type="filepath", label="Use mic")
|
69 |
-
mms_upload_source_iden = gr.Audio(
|
70 |
-
source="upload", type="filepath", label="Upload file", visible=False
|
71 |
-
)
|
72 |
mms_identify = gr.Interface(
|
73 |
fn=identify,
|
74 |
inputs=[
|
75 |
-
|
76 |
-
mms_mic_source_iden,
|
77 |
-
mms_upload_source_iden,
|
78 |
],
|
79 |
outputs=gr.Label(num_top_classes=10),
|
80 |
examples=LID_EXAMPLES,
|
@@ -103,24 +84,6 @@ with gr.Blocks() as demo:
|
|
103 |
)
|
104 |
|
105 |
tabbed_interface.render()
|
106 |
-
mms_select_source_trans.change(
|
107 |
-
lambda x: [
|
108 |
-
gr.update(visible=True if x == "Record from Mic" else False),
|
109 |
-
gr.update(visible=True if x == "Upload audio" else False),
|
110 |
-
],
|
111 |
-
inputs=[mms_select_source_trans],
|
112 |
-
outputs=[mms_mic_source_trans, mms_upload_source_trans],
|
113 |
-
queue=False,
|
114 |
-
)
|
115 |
-
mms_select_source_iden.change(
|
116 |
-
lambda x: [
|
117 |
-
gr.update(visible=True if x == "Record from Mic" else False),
|
118 |
-
gr.update(visible=True if x == "Upload audio" else False),
|
119 |
-
],
|
120 |
-
inputs=[mms_select_source_iden],
|
121 |
-
outputs=[mms_mic_source_iden, mms_upload_source_iden],
|
122 |
-
queue=False,
|
123 |
-
)
|
124 |
gr.HTML(
|
125 |
"""
|
126 |
<div class="footer" style="text-align:center">
|
|
|
7 |
|
8 |
demo = gr.Blocks()
|
9 |
|
10 |
+
|
11 |
+
mms_source_trans = gr.Audio()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
mms_transcribe = gr.Interface(
|
13 |
fn=transcribe,
|
14 |
inputs=[
|
15 |
+
mms_source_trans,
|
|
|
|
|
16 |
gr.Dropdown(
|
17 |
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
|
18 |
label="Language",
|
|
|
51 |
allow_flagging="never",
|
52 |
)
|
53 |
|
54 |
+
mms_source_iden = gr.Audio()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
mms_identify = gr.Interface(
|
56 |
fn=identify,
|
57 |
inputs=[
|
58 |
+
mms_source_iden,
|
|
|
|
|
59 |
],
|
60 |
outputs=gr.Label(num_top_classes=10),
|
61 |
examples=LID_EXAMPLES,
|
|
|
84 |
)
|
85 |
|
86 |
tabbed_interface.render()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
gr.HTML(
|
88 |
"""
|
89 |
<div class="footer" style="text-align:center">
|