import logging import os import sys import gradio as gr # Set up logging logging.getLogger("uvicorn").setLevel(logging.WARNING) logging.getLogger("httpx").setLevel(logging.WARNING) # Add current directory to sys.path now_dir = os.getcwd() sys.path.append(now_dir) # Zluda hijack import rvc.lib.zluda # Run prerequisites from core import run_prerequisites_script from tabs.api.api import api_tab from tabs.download.download import download_tab from tabs.extra.extra import extra_tab # Import Tabs from tabs.inference.inference import inference_tab from tabs.plugins.plugins import plugins_tab from tabs.report.report import report_tab from tabs.settings.settings import settings_tab from tabs.train.train import train_tab from tabs.tts.tts import tts_tab from tabs.voice_blender.voice_blender import voice_blender_tab run_prerequisites_script( pretraineds_hifigan=True, models=True, exe=True, ) # Initialize i18n from assets.i18n.i18n import I18nAuto i18n = I18nAuto() # Check installation import assets.installation_checker as installation_checker installation_checker.check_installation() # Load theme import assets.themes.loadThemes as loadThemes my_applio = loadThemes.load_theme() or "ParityError/Interstellar" # Define Gradio interface with gr.Blocks( theme=my_applio, title="Applio", ) as Applio: gr.Markdown("# Applio") gr.Markdown( i18n( "A simple, high-quality voice conversion tool focused on ease of use and performance." ) ) gr.Markdown( i18n( "[Support](https://discord.gg/urxFjYmYYh) — [GitHub](https://github.com/IAHispano/Applio)" ) ) with gr.Tab(i18n("Inference")): inference_tab() with gr.Tab(i18n("Training")): train_tab() with gr.Tab(i18n("TTS")): tts_tab() with gr.Tab(i18n("Voice Blender")): voice_blender_tab() with gr.Tab(i18n("API")): api_tab() with gr.Tab(i18n("Plugins")): plugins_tab() with gr.Tab(i18n("Download")): download_tab() with gr.Tab(i18n("Report a Bug")): report_tab() with gr.Tab(i18n("Extra")): extra_tab() with gr.Tab(i18n("Settings")): settings_tab() with gr.Tab("Realtime API"): from tabs.api.realtime_api import ( get_available_models, process_audio_stream, ) gr.Markdown("### Realtime Voice Conversion (Streaming)") rt_model_zip = gr.Textbox( label="Model ZIP URL (optional)", placeholder="https://example.com/model.zip", ) with gr.Row(): rt_model = gr.Dropdown( label="Model", choices=get_available_models(), value=None, allow_custom_value=True, ) rt_pitch = gr.Slider(-12, 12, value=0, step=1, label="Pitch") rt_index_rate = gr.Slider(0, 1, value=0.75, step=0.05, label="Index Rate") rt_state = gr.State(None) rt_input = gr.Audio( sources=["microphone"], streaming=True, label="Input (Microphone)", ) rt_output = gr.Audio( streaming=True, label="Output", autoplay=True, ) rt_input.stream( fn=process_audio_stream, inputs=[rt_state, rt_input, rt_model_zip, rt_model, rt_pitch, rt_index_rate], outputs=[rt_state, rt_output], api_name="realtime_convert", ) gr.Markdown( """