File size: 988 Bytes
228b6ea
d5ee34b
228b6ea
 
 
8bf571e
228b6ea
cdc6979
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8bf571e
228b6ea
 
0645fbe
 
228b6ea
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import gradio as gr
from model_inference import (
    inferir_basic_pitch
)

def procesar_wav(input_wav_path: str):
    if not input_wav_path:
        return None
        
    try:
        # 1) Generar archivos midi
        midi_path = inferir_basic_pitch(input_wav_path)
        
        # Verificar que se generó el archivo
        if midi_path and os.path.exists(midi_path):
            return midi_path
        else:
            print("Error: No se pudo generar el archivo MIDI")
            return None
            
    except Exception as e:
        print(f"Error en procesar_wav: {e}")
        return None

demo = gr.Interface(
    fn=procesar_wav,
    inputs=gr.Audio(label="Sube un stem (.wav)", type="filepath"),
    outputs=gr.File(label="Fichero Midi"),
    title="Basic Pitch Inference",
    description="Sube tu archivo de audio para generar el archivo midi correspondiente.",
)

if __name__ == "__main__":
    demo.launch(server_name="0.0.0.0", server_port=7860)