Spaces:
Sleeping
Sleeping
Commit ·
7d30adc
1
Parent(s): 3cb9c07
fix: return actual audio data (numpy) from ZeroGPU function instead of file paths to ensure Gradio receives the content before the worker environment is destroyed
Browse files
app.py
CHANGED
|
@@ -104,7 +104,14 @@ def _full_pipeline_gpu(song_file, reference_path, pitch, diffusion_steps, simila
|
|
| 104 |
instrumental_volume=float(instrumental_volume),
|
| 105 |
)
|
| 106 |
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
|
| 110 |
def train_voice_model(audio_file, model_name, progress=gr.Progress()):
|
|
@@ -357,18 +364,15 @@ with gr.Blocks(
|
|
| 357 |
preview_vocals = gr.Audio(
|
| 358 |
label="Voz original (separada)",
|
| 359 |
interactive=False,
|
| 360 |
-
type="filepath",
|
| 361 |
)
|
| 362 |
preview_converted = gr.Audio(
|
| 363 |
label="Voz convertida",
|
| 364 |
interactive=False,
|
| 365 |
-
type="filepath",
|
| 366 |
)
|
| 367 |
gr.Markdown("**Resultado final:**")
|
| 368 |
final_output = gr.Audio(
|
| 369 |
label="Canción final (voz + instrumentos)",
|
| 370 |
interactive=False,
|
| 371 |
-
type="filepath",
|
| 372 |
)
|
| 373 |
|
| 374 |
refresh_btn.click(
|
|
|
|
| 104 |
instrumental_volume=float(instrumental_volume),
|
| 105 |
)
|
| 106 |
|
| 107 |
+
import librosa
|
| 108 |
+
# Load back the audio data to return it directly.
|
| 109 |
+
# This bypasses ZeroGPU filesystem sync issues.
|
| 110 |
+
v_data, v_sr = librosa.load(vocals_path, sr=None)
|
| 111 |
+
c_data, c_sr = librosa.load(converted_path, sr=None)
|
| 112 |
+
f_data, f_sr = librosa.load(final_path, sr=None)
|
| 113 |
+
|
| 114 |
+
return (v_sr, v_data), (c_sr, c_data), (f_sr, f_data)
|
| 115 |
|
| 116 |
|
| 117 |
def train_voice_model(audio_file, model_name, progress=gr.Progress()):
|
|
|
|
| 364 |
preview_vocals = gr.Audio(
|
| 365 |
label="Voz original (separada)",
|
| 366 |
interactive=False,
|
|
|
|
| 367 |
)
|
| 368 |
preview_converted = gr.Audio(
|
| 369 |
label="Voz convertida",
|
| 370 |
interactive=False,
|
|
|
|
| 371 |
)
|
| 372 |
gr.Markdown("**Resultado final:**")
|
| 373 |
final_output = gr.Audio(
|
| 374 |
label="Canción final (voz + instrumentos)",
|
| 375 |
interactive=False,
|
|
|
|
| 376 |
)
|
| 377 |
|
| 378 |
refresh_btn.click(
|