import argparse import logging import os import sys import os from functools import lru_cache import gradio as gr # non module import from tabs.typing_extra import ALLOWED_DIR, CONFIG import assets.theme.loadThemes as loadThemes from assets.theme.applio import Applio from tabs.infer.infer import inference_tab from tabs.models.model import download_tab, model_manage_tab from tabs.help.help import help_tab # Configure logging logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s", handlers=[logging.StreamHandler(), logging.FileHandler('neorvc.log')] ) logger = logging.getLogger(__name__) # Base directory setup BASE_DIR = os.getcwd() sys.path.append(BASE_DIR) def build_ui(): """Build the Gradio UI with separated tab functions.""" with gr.Blocks( title="Neo RVC", theme=Applio(), fill_height=True, ) as app: gr.Markdown("# Neo RVC: AI Voice extension") status_message = gr.Textbox( label="Status", lines=2, interactive=False, elem_classes=["success", "error"], visible=False ) # Placeholder for rvc_model to be shared across tabs rvc_model = gr.State(value=None) with gr.Tabs(): rvc_model = inference_tab(status_message, rvc_model) with gr.TabItem("Models Options"): download_tab(status_message, rvc_model) model_manage_tab(status_message, rvc_model) help_tab() return app app = build_ui() app.queue() app.launch(allowed_paths=[ALLOWED_DIR])