| |
| import os |
| import gradio as gr |
| from audio_pipeline import ( |
| separar_audio_demucs_6stems, |
| limpiar_stems, |
| combinar_stems_sin_vocales, |
| reducir_ruido |
| ) |
|
|
|
|
| def procesar_wav(input_wav_path: str): |
| |
| stems_dir = separar_audio_demucs_6stems(input_wav_path) |
|
|
| |
| limpiar_stems(stems_dir) |
|
|
| |
| labels = ["vocals", "drums", "bass", "guitar", "piano", "other"] |
| stems_paths = [os.path.join(stems_dir, f"{lbl}_cleaned.wav") for lbl in labels] |
|
|
| |
| combinar_stems_sin_vocales(stems_dir) |
| base_raw = os.path.join(stems_dir, "base_instrumental.wav") |
|
|
| |
| clean_base = os.path.join(stems_dir, "base_instrumental_clean.wav") |
| reducir_ruido(base_raw, clean_base) |
|
|
| |
| return (*stems_paths, clean_base) |
|
|
|
|
| demo = gr.Interface( |
| fn=procesar_wav, |
| inputs=gr.Audio(label="Sube un archivo .wav", type="filepath"), |
| outputs=[ |
| gr.Audio(label="Vocals limpio", type="filepath"), |
| gr.Audio(label="Drums limpio", type="filepath"), |
| gr.Audio(label="Bass limpio", type="filepath"), |
| gr.Audio(label="Guitar limpio", type="filepath"), |
| gr.Audio(label="Piano limpio", type="filepath"), |
| gr.Audio(label="Other limpio", type="filepath"), |
| gr.Audio(label="Base instrumental limpia", type="filepath"), |
| ], |
| title="Demucs 6-stems + Calidad Mejorada", |
| description="Sube tu WAV y obtén 6 stems limpios (incluye guitarra) más la base instrumental mejorada." |
| ) |
|
|
| if __name__ == "__main__": |
| demo.launch(server_name="0.0.0.0", server_port=7860) |
|
|