File size: 3,647 Bytes
3e8e7fc
7d597db
4efe6b5
 
2c02b19
 
 
 
 
 
 
 
 
7d597db
2c02b19
4efe6b5
 
7d597db
2c02b19
4efe6b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2c02b19
4efe6b5
 
 
 
2c02b19
 
 
4efe6b5
2c02b19
 
 
 
 
4efe6b5
2c02b19
 
 
 
4efe6b5
 
2c02b19
 
 
 
4efe6b5
 
 
2c02b19
 
 
 
4efe6b5
2c02b19
3e8e7fc
 
4efe6b5
 
2c02b19
 
 
 
 
 
4efe6b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2c02b19
 
4efe6b5
 
2c02b19
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import spaces
import gradio as gr
import sys
import os
import logging

# Constants
DEFAULT_PORT = 6969
MAX_PORT_ATTEMPTS = 10

# 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)

# Import Tabs
from tabs.inference.inference import inference_tab
from tabs.train.train import train_tab
from tabs.extra.extra import extra_tab
from tabs.report.report import report_tab
from tabs.download.download import download_tab
from tabs.tts.tts import tts_tab
from tabs.voice_blender.voice_blender import voice_blender_tab
from tabs.plugins.plugins import plugins_tab
from tabs.settings.version import version_tab
from tabs.settings.lang import lang_tab
from tabs.settings.restart import restart_tab
from tabs.settings.presence import presence_tab, load_config_presence
from tabs.settings.flask_server import flask_server_tab
from tabs.settings.fake_gpu import fake_gpu_tab, gpu_available, load_fake_gpu
from tabs.settings.themes import theme_tab
from tabs.settings.precision import precision_tab

# Run prerequisites
from core import run_prerequisites_script

run_prerequisites_script(False, True, True, True)

# Initialize i18n
from assets.i18n.i18n import I18nAuto

i18n = I18nAuto()

# Start Discord presence if enabled
if load_config_presence():
    from assets.discord_presence import RPCManager

    RPCManager.start_presence()

# Check installation
import assets.installation_checker as installation_checker

installation_checker.check_installation()

# Start Flask server if enabled
from assets.flask.server import start_flask, load_config_flask

if load_config_flask():
    print("Starting Flask server")
    start_flask()

# Load theme
import assets.themes.loadThemes as loadThemes

my_applio = loadThemes.load_json() or "ParityError/Interstellar"

# Define Gradio interface
with gr.Blocks(theme=my_applio, title="Applio V3.2.5") as Applio:
    gr.Markdown("Applio V3.2.5")
    gr.Markdown(
        i18n(
            "VITS-based Voice Conversion focused on simplicity, quality and performance."
        )
    )
    gr.Markdown(
        i18n(
            "[Support](https://discord.gg/IAHispano) β€” [Discord Bot](https://discord.com/oauth2/authorize?client_id=1144714449563955302&permissions=1376674695271&scope=bot%20applications.commands) β€” [Find Voices](https://applio.org/models) β€” [GitHub](https://github.com/IAHispano/Applio)"
        )
    )
    with gr.Tab(i18n("Inference")):
        inference_tab()

    with gr.Tab(i18n("Train")):
        if gpu_available() or load_fake_gpu():
            train_tab()
        else:
            gr.Markdown(
                i18n(
                    "Training is currently unsupported due to the absence of a GPU. To activate the training tab, navigate to the settings tab and enable the 'Fake GPU' option."
                )
            )

    with gr.Tab(i18n("TTS")):
        tts_tab()

    with gr.Tab(i18n("Voice Blender")):
        voice_blender_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")):
        presence_tab()
        flask_server_tab()
        precision_tab()
        if not gpu_available():
            fake_gpu_tab()
        theme_tab()
        version_tab()
        lang_tab()
        restart_tab()


def launch_gradio(port):
    Applio.launch(share=True)

if __name__ == "__main__":
    launch_gradio()