sob111 commited on
Commit
5b613b4
·
verified ·
1 Parent(s): b41cd21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -8,13 +8,12 @@ def tts_infer(text):
8
  if not os.path.exists(MODEL_PATH):
9
  return "Modelo no encontrado. Ejecuta primero: python finetune_xtts_peninsular_hf.py", None
10
  tts = TTS(MODEL_PATH)
11
- out_file = "output.wav"
12
  tts.tts_to_file(text=text, file_path=out_file, language="es")
13
- return f"Audio generado con acento peninsular", out_file
14
 
15
  with gr.Blocks() as demo:
16
  gr.Markdown("# XTTSv2 español peninsular")
17
- gr.Markdown("Si no hay modelo, primero ejecuta `python finetune_xtts_peninsular_hf.py` en este Space.")
18
  text_input = gr.Textbox(label="Texto en español", lines=3)
19
  btn = gr.Button("Generar audio")
20
  status = gr.Label()
@@ -23,4 +22,3 @@ with gr.Blocks() as demo:
23
  btn.click(fn=tts_infer, inputs=text_input, outputs=[status, audio_out])
24
 
25
  demo.launch(server_name="0.0.0.0", server_port=7860)
26
-
 
8
  if not os.path.exists(MODEL_PATH):
9
  return "Modelo no encontrado. Ejecuta primero: python finetune_xtts_peninsular_hf.py", None
10
  tts = TTS(MODEL_PATH)
11
+ out_file = os.path.abspath("output.wav")
12
  tts.tts_to_file(text=text, file_path=out_file, language="es")
13
+ return "Audio generado con acento peninsular", out_file
14
 
15
  with gr.Blocks() as demo:
16
  gr.Markdown("# XTTSv2 español peninsular")
 
17
  text_input = gr.Textbox(label="Texto en español", lines=3)
18
  btn = gr.Button("Generar audio")
19
  status = gr.Label()
 
22
  btn.click(fn=tts_infer, inputs=text_input, outputs=[status, audio_out])
23
 
24
  demo.launch(server_name="0.0.0.0", server_port=7860)