Update main.py
Browse files
main.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import os
|
2 |
|
3 |
if 'TORTOISE_MODELS_DIR' not in os.environ:
|
4 |
-
|
5 |
|
6 |
if 'TRANSFORMERS_CACHE' not in os.environ:
|
7 |
-
|
8 |
|
9 |
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'python'
|
10 |
|
@@ -12,29 +12,29 @@ from utils import *
|
|
12 |
from webui import *
|
13 |
|
14 |
if __name__ == "__main__":
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
elif __name__ == "main":
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
|
|
1 |
import os
|
2 |
|
3 |
if 'TORTOISE_MODELS_DIR' not in os.environ:
|
4 |
+
os.environ['TORTOISE_MODELS_DIR'] = os.path.realpath(os.path.join(os.getcwd(), './models/tortoise/'))
|
5 |
|
6 |
if 'TRANSFORMERS_CACHE' not in os.environ:
|
7 |
+
os.environ['TRANSFORMERS_CACHE'] = os.path.realpath(os.path.join(os.getcwd(), './models/transformers/'))
|
8 |
|
9 |
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'python'
|
10 |
|
|
|
12 |
from webui import *
|
13 |
|
14 |
if __name__ == "__main__":
|
15 |
+
args = setup_args()
|
16 |
+
|
17 |
+
if args.listen_path is not None and args.listen_path != "/":
|
18 |
+
import uvicorn
|
19 |
+
uvicorn.run("main:app", host=args.listen_host, port=args.listen_port if not None else 8000)
|
20 |
+
else:
|
21 |
+
webui = setup_gradio()
|
22 |
+
webui.launch(share=True, prevent_thread_lock=True, show_error=True, server_name=args.listen_host, server_port=args.listen_port)
|
23 |
+
if not args.defer_tts_load:
|
24 |
+
tts = load_tts()
|
25 |
+
|
26 |
+
webui.block_thread()
|
27 |
elif __name__ == "main":
|
28 |
+
from fastapi import FastAPI
|
29 |
+
import gradio as gr
|
30 |
|
31 |
+
import sys
|
32 |
+
sys.argv = [sys.argv[0]]
|
33 |
|
34 |
+
app = FastAPI()
|
35 |
+
args = setup_args()
|
36 |
+
webui = setup_gradio()
|
37 |
+
app = gr.mount_gradio_app(app, webui, path=args.listen_path)
|
38 |
|
39 |
+
if not args.defer_tts_load:
|
40 |
+
tts = load_tts()
|