forked from Akegarasu/vits-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webui.py
56 lines (43 loc) · 1.28 KB
/
webui.py
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
# 転がる岩、君に朝が降る
# Code with Love by @Akegarasu
import os
import sys
# must import before other modules load model.
import modules.safe
import modules.path
from modules.ui import create_ui
import modules.vits_model as vits_model
import modules.sovits_model as sovits_model
from modules.options import cmd_opts
def init():
print(f"Launching webui with arguments: {' '.join(sys.argv[1:])}")
ensure_output_dirs()
vits_model.refresh_list()
sovits_model.refresh_list()
# if cmd_opts.ui_debug_mode:
# return
def ensure_output_dirs():
def check_and_create(p):
if not os.path.exists(p):
os.makedirs(p)
check_and_create("outputs/vits")
check_and_create("outputs/vits-batch")
check_and_create("outputs/sovits")
check_and_create("outputs/sovits-batch")
check_and_create("temp")
def run():
init()
app = create_ui()
if cmd_opts.server_name:
server_name = cmd_opts.server_name
else:
server_name = "0.0.0.0" if cmd_opts.listen else None
app.queue(default_enabled=False).launch(
share=cmd_opts.share,
server_name=server_name,
server_port=cmd_opts.port,
inbrowser=cmd_opts.autolaunch,
show_api=False
)
if __name__ == "__main__":
run()