Hjgugugjhuhjggg
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def generate_music(text_prompt, audio_prompt=None, tts_text=None):
|
|
21 |
audio_values = model_musicgen.generate(**inputs.to("cpu"), max_new_tokens=max_new_tokens, min_new_tokens=min_new_tokens)
|
22 |
music = audio_values.cpu().numpy()[0]
|
23 |
|
24 |
-
if audio_prompt
|
25 |
cloned_audio = model_tts.tts_with_vc(tts_text, speaker_wav=audio_prompt, language="es")
|
26 |
|
27 |
if model_tts.synthesizer.output_sample_rate != 44100:
|
@@ -49,8 +49,8 @@ iface = gr.Interface(
|
|
49 |
fn=generate_music,
|
50 |
inputs=[
|
51 |
gr.Textbox(label="Descripción de la música"),
|
52 |
-
gr.Audio(type=("filepath", "microphone"), label="Audio de voz (Opcional)"
|
53 |
-
gr.Textbox(label="Texto para clonar la voz (Opcional)"
|
54 |
],
|
55 |
outputs=gr.Audio(label="Música generada", type="numpy"),
|
56 |
title="Generador de Música con MusicGen y XTTS",
|
|
|
21 |
audio_values = model_musicgen.generate(**inputs.to("cpu"), max_new_tokens=max_new_tokens, min_new_tokens=min_new_tokens)
|
22 |
music = audio_values.cpu().numpy()[0]
|
23 |
|
24 |
+
if audio_prompt and tts_text: # Simplificado: si ambos existen
|
25 |
cloned_audio = model_tts.tts_with_vc(tts_text, speaker_wav=audio_prompt, language="es")
|
26 |
|
27 |
if model_tts.synthesizer.output_sample_rate != 44100:
|
|
|
49 |
fn=generate_music,
|
50 |
inputs=[
|
51 |
gr.Textbox(label="Descripción de la música"),
|
52 |
+
gr.Audio(type=("filepath", "microphone"), label="Audio de voz (Opcional)"),
|
53 |
+
gr.Textbox(label="Texto para clonar la voz (Opcional)"),
|
54 |
],
|
55 |
outputs=gr.Audio(label="Música generada", type="numpy"),
|
56 |
title="Generador de Música con MusicGen y XTTS",
|