RafaG commited on
Commit
8abf4ab
1 Parent(s): af4df84

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -57
app.py CHANGED
@@ -189,21 +189,22 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
189
  with gr.Tabs():
190
  with gr.TabItem("Edge-TTS"):
191
  gr.Markdown("É ilimitado, podendo até mesmo colocar um livro inteiro, mas claro, tem a questão de tempo, quanto maior o texto, mais demorado é, dublagem por SRT talvez um dia eu bote.")
192
-
193
- # Language selection dropdown
194
- language_input = gr.Dropdown(
195
- choices=available_languages,
196
- label="Idioma",
197
- value=available_languages[52] if available_languages else None
198
- )
199
 
200
- # Voice model dropdown (will be updated based on language selection)
201
- initial_voices = get_voice_options(available_languages[52], voices_data) if available_languages else []
202
- voice_model_input = gr.Dropdown(
203
- choices=initial_voices,
204
- label="Modelo de Voz",
205
- value=initial_voices[0] if initial_voices else None
206
- )
 
 
 
 
 
 
 
 
207
 
208
  # Connect language selection to voice model update
209
  language_input.change(
@@ -243,21 +244,22 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
243
  checkbox_cortar_silencio = gr.Checkbox(label="Cortar Silencio", interactive=True)
244
  audio_output = gr.Audio(label="Resultado", type="filepath", interactive=False)
245
 
246
- edgetts_button = gr.Button(value="Falar")
247
- edgetts_button.click(
248
- controlador_generate_audio,
249
- inputs=[
250
- audio_input,
251
- voice_model_input,
252
- speed_input,
253
- pitch_input, # New input
254
- volume_input, # New input
255
- checkbox_cortar_silencio
256
- ],
257
- outputs=[audio_output]
258
- )
259
-
260
- clear_button = gr.ClearButton(audio_input, value='Limpar')
 
261
 
262
  # Add update voices button at the top
263
  update_voices_btn = gr.Button(value="Atualizar Lista de Vozes")
@@ -272,18 +274,19 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
272
  with gr.TabItem("Lote (Arquivo txt)"):
273
  gr.Markdown("Carregar texto de um arquivo")
274
  # Language and voice selection (same as first tab)
275
- language_input_file = gr.Dropdown(
276
- choices=available_languages,
277
- label="Idioma",
278
- value=available_languages[52] if available_languages else None
279
- )
280
-
281
- initial_voices = get_voice_options(available_languages[52], voices_data) if available_languages else []
282
- voice_model_input_file = gr.Dropdown(
283
- choices=initial_voices,
284
- label="Modelo de Voz",
285
- value=initial_voices[0] if initial_voices else None
286
- )
 
287
 
288
  language_input_file.change(
289
  fn=update_voice_options,
@@ -326,22 +329,22 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="blue"
326
 
327
  checkbox_cortar_silencio_file = gr.Checkbox(label="Cortar Silencio", interactive=True)
328
  audio_output_file = gr.Audio(label="Resultado", type="filepath", interactive=False)
329
-
330
- edgetts_button_file = gr.Button(value="Falar")
331
- edgetts_button_file.click(
332
- controlador_generate_audio_from_file,
333
- inputs=[
334
- file_input,
335
- voice_model_input_file,
336
- speed_input_file,
337
- pitch_input_file,
338
- volume_input_file,
339
- checkbox_cortar_silencio_file
340
- ],
341
- outputs=[audio_output_file]
342
- )
343
-
344
- clear_button_file = gr.ClearButton(file_input, value='Limpar')
345
 
346
  gr.Markdown("Agradecimentos a rany2 pelo Edge-TTS")
347
 
 
189
  with gr.Tabs():
190
  with gr.TabItem("Edge-TTS"):
191
  gr.Markdown("É ilimitado, podendo até mesmo colocar um livro inteiro, mas claro, tem a questão de tempo, quanto maior o texto, mais demorado é, dublagem por SRT talvez um dia eu bote.")
 
 
 
 
 
 
 
192
 
193
+ with gr.Row():
194
+ # Language selection dropdown
195
+ language_input = gr.Dropdown(
196
+ choices=available_languages,
197
+ label="Idioma",
198
+ value=available_languages[52] if available_languages else None
199
+ )
200
+
201
+ # Voice model dropdown (will be updated based on language selection)
202
+ initial_voices = get_voice_options(available_languages[52], voices_data) if available_languages else []
203
+ voice_model_input = gr.Dropdown(
204
+ choices=initial_voices,
205
+ label="Modelo de Voz",
206
+ value=initial_voices[0] if initial_voices else None
207
+ )
208
 
209
  # Connect language selection to voice model update
210
  language_input.change(
 
244
  checkbox_cortar_silencio = gr.Checkbox(label="Cortar Silencio", interactive=True)
245
  audio_output = gr.Audio(label="Resultado", type="filepath", interactive=False)
246
 
247
+ with gr.Row():
248
+ edgetts_button = gr.Button(value="Falar")
249
+ edgetts_button.click(
250
+ controlador_generate_audio,
251
+ inputs=[
252
+ audio_input,
253
+ voice_model_input,
254
+ speed_input,
255
+ pitch_input, # New input
256
+ volume_input, # New input
257
+ checkbox_cortar_silencio
258
+ ],
259
+ outputs=[audio_output]
260
+ )
261
+
262
+ clear_button = gr.ClearButton(audio_input, value='Limpar')
263
 
264
  # Add update voices button at the top
265
  update_voices_btn = gr.Button(value="Atualizar Lista de Vozes")
 
274
  with gr.TabItem("Lote (Arquivo txt)"):
275
  gr.Markdown("Carregar texto de um arquivo")
276
  # Language and voice selection (same as first tab)
277
+ with gr.Row():
278
+ language_input_file = gr.Dropdown(
279
+ choices=available_languages,
280
+ label="Idioma",
281
+ value=available_languages[52] if available_languages else None
282
+ )
283
+
284
+ initial_voices = get_voice_options(available_languages[52], voices_data) if available_languages else []
285
+ voice_model_input_file = gr.Dropdown(
286
+ choices=initial_voices,
287
+ label="Modelo de Voz",
288
+ value=initial_voices[0] if initial_voices else None
289
+ )
290
 
291
  language_input_file.change(
292
  fn=update_voice_options,
 
329
 
330
  checkbox_cortar_silencio_file = gr.Checkbox(label="Cortar Silencio", interactive=True)
331
  audio_output_file = gr.Audio(label="Resultado", type="filepath", interactive=False)
332
+ with gr.Row():
333
+ edgetts_button_file = gr.Button(value="Falar")
334
+ edgetts_button_file.click(
335
+ controlador_generate_audio_from_file,
336
+ inputs=[
337
+ file_input,
338
+ voice_model_input_file,
339
+ speed_input_file,
340
+ pitch_input_file,
341
+ volume_input_file,
342
+ checkbox_cortar_silencio_file
343
+ ],
344
+ outputs=[audio_output_file]
345
+ )
346
+
347
+ clear_button_file = gr.ClearButton(file_input, value='Limpar')
348
 
349
  gr.Markdown("Agradecimentos a rany2 pelo Edge-TTS")
350