Spaces:
Running
Running
| """ | |
| UI components and helper functions for Gradio. | |
| """ | |
| import gradio as gr | |
| from .config import OUTPUT_FORMATS, DEFAULT_OUTPUT_FORMAT | |
| from .models import list_models | |
| # Funções originais (mantidas) | |
| def refresh_models(): | |
| models = list_models() | |
| return gr.update(value=models, choices=models), models | |
| def toggle_autotune(enable): | |
| return gr.update(visible=enable) | |
| def upload_model(zip_file, model_name): | |
| # Implementação original | |
| return "Model uploaded", list_models(), list_models() | |
| # Novas funções para UI | |
| def create_video_section(): | |
| return gr.Video( | |
| label="Upload Video (MP4, WebM, etc.)", | |
| sources=["upload"], | |
| format="mp4", | |
| height=300, | |
| ) | |
| def create_five_outputs(): | |
| with gr.Row(): | |
| with gr.Column(): | |
| gr.Markdown("#### 🎤 Input Files (no RVC)") | |
| entrada_acapella = gr.Audio(label="Acapella (extracted)", type="filepath", interactive=False) | |
| entrada_audio = gr.Audio(label="Original Audio", type="filepath", interactive=False) | |
| entrada_instrumental = gr.Audio(label="Instrumental (extracted)", type="filepath", interactive=False) | |
| with gr.Column(): | |
| gr.Markdown("#### 🎙️ Output Files (with RVC)") | |
| saida_audio = gr.Audio(label="RVC on original", type="filepath", interactive=False) | |
| saida_acapella = gr.Audio(label="RVC on acapella", type="filepath", interactive=False) | |
| return entrada_acapella, entrada_audio, entrada_instrumental, saida_audio, saida_acapella |