hysts HF staff commited on
Commit
9419e6a
1 Parent(s): c3b9be5
Files changed (2) hide show
  1. app.py +86 -69
  2. style.css +0 -6
app.py CHANGED
@@ -124,21 +124,25 @@ def run_asr(input_audio: str, target_language: str) -> str:
124
 
125
 
126
  with gr.Blocks() as demo_s2st:
127
- with gr.Group():
128
- target_language = gr.Dropdown(
129
- label="Target language",
130
- choices=S2ST_TARGET_LANGUAGE_NAMES,
131
- value=DEFAULT_TARGET_LANGUAGE,
132
- )
133
- input_audio = gr.Audio(label="Input speech", type="filepath")
134
- btn = gr.Button("Translate")
135
- output_audio = gr.Audio(
136
- label="Translated speech",
137
- autoplay=False,
138
- streaming=False,
139
- type="numpy",
140
- )
141
- output_text = gr.Textbox(label="Translated text")
 
 
 
 
142
 
143
  gr.Examples(
144
  examples=[
@@ -162,15 +166,18 @@ with gr.Blocks() as demo_s2st:
162
  )
163
 
164
  with gr.Blocks() as demo_s2tt:
165
- with gr.Group():
166
- target_language = gr.Dropdown(
167
- label="Target language",
168
- choices=S2TT_TARGET_LANGUAGE_NAMES,
169
- value=DEFAULT_TARGET_LANGUAGE,
170
- )
171
- input_audio = gr.Audio(label="Input speech", type="filepath")
172
- btn = gr.Button("Translate")
173
- output_text = gr.Textbox(label="Translated text")
 
 
 
174
 
175
  gr.Examples(
176
  examples=[
@@ -194,27 +201,31 @@ with gr.Blocks() as demo_s2tt:
194
  )
195
 
196
  with gr.Blocks() as demo_t2st:
197
- with gr.Group():
198
- with gr.Row():
199
- source_language = gr.Dropdown(
200
- label="Source language",
201
- choices=TEXT_SOURCE_LANGUAGE_NAMES,
202
- value="English",
203
- )
204
- target_language = gr.Dropdown(
205
- label="Target language",
206
- choices=T2ST_TARGET_LANGUAGE_NAMES,
207
- value=DEFAULT_TARGET_LANGUAGE,
208
- )
209
- input_text = gr.Textbox(label="Input text")
210
- btn = gr.Button("Translate")
211
- output_audio = gr.Audio(
212
- label="Translated speech",
213
- autoplay=False,
214
- streaming=False,
215
- type="numpy",
216
- )
217
- output_text = gr.Textbox(label="Translated text")
 
 
 
 
218
 
219
  gr.Examples(
220
  examples=[
@@ -255,21 +266,24 @@ with gr.Blocks() as demo_t2st:
255
  )
256
 
257
  with gr.Blocks() as demo_t2tt:
258
- with gr.Group():
259
- with gr.Row():
260
- source_language = gr.Dropdown(
261
- label="Source language",
262
- choices=TEXT_SOURCE_LANGUAGE_NAMES,
263
- value="English",
264
- )
265
- target_language = gr.Dropdown(
266
- label="Target language",
267
- choices=T2TT_TARGET_LANGUAGE_NAMES,
268
- value=DEFAULT_TARGET_LANGUAGE,
269
- )
270
- input_text = gr.Textbox(label="Input text")
271
- btn = gr.Button("Translate")
272
- output_text = gr.Textbox(label="Translated text")
 
 
 
273
 
274
  gr.Examples(
275
  examples=[
@@ -310,15 +324,18 @@ with gr.Blocks() as demo_t2tt:
310
  )
311
 
312
  with gr.Blocks() as demo_asr:
313
- with gr.Group():
314
- target_language = gr.Dropdown(
315
- label="Target language",
316
- choices=ASR_TARGET_LANGUAGE_NAMES,
317
- value=DEFAULT_TARGET_LANGUAGE,
318
- )
319
- input_audio = gr.Audio(label="Input speech", type="filepath")
320
- btn = gr.Button("Translate")
321
- output_text = gr.Textbox(label="Translated text")
 
 
 
322
 
323
  gr.Examples(
324
  examples=[
 
124
 
125
 
126
  with gr.Blocks() as demo_s2st:
127
+ with gr.Row():
128
+ with gr.Column():
129
+ with gr.Group():
130
+ target_language = gr.Dropdown(
131
+ label="Target language",
132
+ choices=S2ST_TARGET_LANGUAGE_NAMES,
133
+ value=DEFAULT_TARGET_LANGUAGE,
134
+ )
135
+ input_audio = gr.Audio(label="Input speech", type="filepath")
136
+ btn = gr.Button("Translate")
137
+ with gr.Column():
138
+ with gr.Group():
139
+ output_audio = gr.Audio(
140
+ label="Translated speech",
141
+ autoplay=False,
142
+ streaming=False,
143
+ type="numpy",
144
+ )
145
+ output_text = gr.Textbox(label="Translated text")
146
 
147
  gr.Examples(
148
  examples=[
 
166
  )
167
 
168
  with gr.Blocks() as demo_s2tt:
169
+ with gr.Row():
170
+ with gr.Column():
171
+ with gr.Group():
172
+ target_language = gr.Dropdown(
173
+ label="Target language",
174
+ choices=S2TT_TARGET_LANGUAGE_NAMES,
175
+ value=DEFAULT_TARGET_LANGUAGE,
176
+ )
177
+ input_audio = gr.Audio(label="Input speech", type="filepath")
178
+ btn = gr.Button("Translate")
179
+ with gr.Column():
180
+ output_text = gr.Textbox(label="Translated text")
181
 
182
  gr.Examples(
183
  examples=[
 
201
  )
202
 
203
  with gr.Blocks() as demo_t2st:
204
+ with gr.Row():
205
+ with gr.Column():
206
+ with gr.Group():
207
+ with gr.Row():
208
+ source_language = gr.Dropdown(
209
+ label="Source language",
210
+ choices=TEXT_SOURCE_LANGUAGE_NAMES,
211
+ value="English",
212
+ )
213
+ target_language = gr.Dropdown(
214
+ label="Target language",
215
+ choices=T2ST_TARGET_LANGUAGE_NAMES,
216
+ value=DEFAULT_TARGET_LANGUAGE,
217
+ )
218
+ input_text = gr.Textbox(label="Input text")
219
+ btn = gr.Button("Translate")
220
+ with gr.Column():
221
+ with gr.Group():
222
+ output_audio = gr.Audio(
223
+ label="Translated speech",
224
+ autoplay=False,
225
+ streaming=False,
226
+ type="numpy",
227
+ )
228
+ output_text = gr.Textbox(label="Translated text")
229
 
230
  gr.Examples(
231
  examples=[
 
266
  )
267
 
268
  with gr.Blocks() as demo_t2tt:
269
+ with gr.Row():
270
+ with gr.Column():
271
+ with gr.Group():
272
+ with gr.Row():
273
+ source_language = gr.Dropdown(
274
+ label="Source language",
275
+ choices=TEXT_SOURCE_LANGUAGE_NAMES,
276
+ value="English",
277
+ )
278
+ target_language = gr.Dropdown(
279
+ label="Target language",
280
+ choices=T2TT_TARGET_LANGUAGE_NAMES,
281
+ value=DEFAULT_TARGET_LANGUAGE,
282
+ )
283
+ input_text = gr.Textbox(label="Input text")
284
+ btn = gr.Button("Translate")
285
+ with gr.Column():
286
+ output_text = gr.Textbox(label="Translated text")
287
 
288
  gr.Examples(
289
  examples=[
 
324
  )
325
 
326
  with gr.Blocks() as demo_asr:
327
+ with gr.Row():
328
+ with gr.Column():
329
+ with gr.Group():
330
+ target_language = gr.Dropdown(
331
+ label="Target language",
332
+ choices=ASR_TARGET_LANGUAGE_NAMES,
333
+ value=DEFAULT_TARGET_LANGUAGE,
334
+ )
335
+ input_audio = gr.Audio(label="Input speech", type="filepath")
336
+ btn = gr.Button("Translate")
337
+ with gr.Column():
338
+ output_text = gr.Textbox(label="Translated text")
339
 
340
  gr.Examples(
341
  examples=[
style.css CHANGED
@@ -8,9 +8,3 @@ h1 {
8
  background: #1565c0;
9
  border-radius: 100vh;
10
  }
11
-
12
- .contain {
13
- max-width: 730px;
14
- margin: auto;
15
- padding-top: 1.5rem;
16
- }
 
8
  background: #1565c0;
9
  border-radius: 100vh;
10
  }