CoolFace
Apppublic

Soul-AILab/SoulX-Singer

sourceHugging Faceupdated 7mo agoView on Hugging Face
185likes
app.py60 linesDownload Raw Back to root
1"""2Hugging Face Space entry point for SoulX-Singer.3Downloads pretrained models from the Hub if needed, then launches the Gradio app.4"""5 6import os7from pathlib import Path8 9# Set matplotlib backend before any imports that might use it (required for headless environments)10import matplotlib11matplotlib.use('Agg')  # Use non-interactive backend12 13from ensure_models import ensure_pretrained_models14 15ROOT = Path(__file__).resolve().parent16 17if __name__ == "__main__":18    os.chdir(ROOT)19    ensure_pretrained_models()20 21    import gradio as gr22    from webui import render_tab_content as render_svs_tab23    from webui_svc import render_tab_content as render_svc_tab24 25    with gr.Blocks(title="SoulX-Singer", theme=gr.themes.Default()) as page:26        gr.HTML(27            '<div style="'28            'text-align: center; '29            'padding: 1.25rem 0 1.5rem; '30            'margin-bottom: 0.5rem;'31            '">'32            '<div style="'33            'display: inline-block; '34            'font-size: 1.75rem; '35            'font-weight: 700; '36            'letter-spacing: 0.02em; '37            'line-height: 1.3;'38            '">SoulX-Singer</div>'39            '<div style="'40            'width: 80px; '41            'height: 3px; '42            'margin: 1rem auto 0; '43            'background: linear-gradient(90deg, transparent, #6366f1, transparent); '44            'border-radius: 2px;'45            '"></div>'46            '</div>'47        )48        with gr.Tabs():49            with gr.Tab("Singing Voice Synthesis"):50                render_svs_tab()51            with gr.Tab("Singing Voice Conversion"):52                render_svc_tab()53 54    page.queue()55    page.launch(56        server_name="0.0.0.0",57        server_port=int(os.environ.get("PORT", "7860")),58        share=True,59    )60