Spaces:
Sleeping
Sleeping
File size: 1,510 Bytes
6bbd5b5 8466697 d021c47 6bbd5b5 8466697 3e532f8 d021c47 8466697 d021c47 8466697 3e532f8 8466697 d021c47 8466697 6bbd5b5 3e532f8 8466697 3e532f8 d021c47 3e532f8 d021c47 3e532f8 8466697 3e532f8 8466697 3e532f8 d021c47 3e532f8 d021c47 3e532f8 d021c47 3e532f8 d021c47 6bbd5b5 d021c47 |
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import gradio as gr
import librosa
import numpy as np
import os
from pathlib import Path
# Configuraci贸n
SAMPLE_RATE = 44100
BASE_DIR = Path(__file__).parent
MODEL_FILES = {
"model": BASE_DIR / "yebama_e200_s3200.pth",
"index": BASE_DIR / "added_IVF403_Flat_nprobe_1_yebama_v2.index",
"config": BASE_DIR / "config.json"
}
def verify_files():
"""Verificaci贸n robusta de archivos"""
missing = [f.name for f in MODEL_FILES.values() if not f.exists()]
if missing:
raise FileNotFoundError(f"Archivos faltantes: {', '.join(missing)}")
def process_audio(audio_path):
try:
verify_files()
audio, sr = librosa.load(audio_path, sr=SAMPLE_RATE, mono=True)
# --- AQU脥 VA TU INFERENCIA RVC ---
processed_audio = audio # Placeholder
return (sr, processed_audio.astype(np.float32)) # Tipo expl铆cito
except Exception as e:
raise gr.Error(f"Error: {str(e)}")
# Interfaz
with gr.Blocks(title="Yebama RVC") as app:
gr.Markdown("## 馃帳 Conversor de Voz Yebama RVC")
with gr.Row():
input_audio = gr.Audio(
sources=["upload"],
type="filepath",
label="Audio de entrada"
)
output_audio = gr.Audio(
label="Resultado",
type="numpy" # Formato 贸ptimo
)
gr.Button("Convertir").click(process_audio, input_audio, output_audio)
# Configuraci贸n 贸ptima para Spaces
app.launch(server_port=7860, show_error=True) |