Spaces:
Running
Running
SayaSS
commited on
Commit
•
11ee98a
1
Parent(s):
78d263e
update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import numpy as np
|
|
6 |
import soundfile
|
7 |
from inference.infer_tool import Svc
|
8 |
import logging
|
|
|
9 |
|
10 |
logging.getLogger('numba').setLevel(logging.WARNING)
|
11 |
logging.getLogger('markdown_it').setLevel(logging.WARNING)
|
@@ -35,10 +36,17 @@ def create_vc_fn(model, sid):
|
|
35 |
return vc_fn
|
36 |
|
37 |
if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
models = []
|
39 |
for f in os.listdir("models"):
|
40 |
name = f
|
41 |
-
model = Svc(fr"models/{f}/{f}.pth", f"models/{f}/config.json")
|
42 |
cover = f"models/{f}/cover.png" if os.path.exists(f"models/{f}/cover.png") else None
|
43 |
models.append((name, cover, create_vc_fn(model, name)))
|
44 |
with gr.Blocks() as app:
|
@@ -69,4 +77,6 @@ if __name__ == '__main__':
|
|
69 |
vc_output1 = gr.Textbox(label="Output Message")
|
70 |
vc_output2 = gr.Audio(label="Output Audio")
|
71 |
vc_submit.click(vc_fn, [vc_input, vc_transform, auto_f0], [vc_output1, vc_output2])
|
72 |
-
|
|
|
|
|
|
6 |
import soundfile
|
7 |
from inference.infer_tool import Svc
|
8 |
import logging
|
9 |
+
import webbrowser
|
10 |
|
11 |
logging.getLogger('numba').setLevel(logging.WARNING)
|
12 |
logging.getLogger('markdown_it').setLevel(logging.WARNING)
|
|
|
36 |
return vc_fn
|
37 |
|
38 |
if __name__ == '__main__':
|
39 |
+
parser = argparse.ArgumentParser()
|
40 |
+
parser.add_argument('--device', type=str, default='cpu')
|
41 |
+
parser.add_argument('--api', action="store_true", default=False)
|
42 |
+
parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
|
43 |
+
parser.add_argument("--colab", action="store_true", default=False, help="share gradio app")
|
44 |
+
args = parser.parse_args()
|
45 |
+
|
46 |
models = []
|
47 |
for f in os.listdir("models"):
|
48 |
name = f
|
49 |
+
model = Svc(fr"models/{f}/{f}.pth", f"models/{f}/config.json", device=args.device)
|
50 |
cover = f"models/{f}/cover.png" if os.path.exists(f"models/{f}/cover.png") else None
|
51 |
models.append((name, cover, create_vc_fn(model, name)))
|
52 |
with gr.Blocks() as app:
|
|
|
77 |
vc_output1 = gr.Textbox(label="Output Message")
|
78 |
vc_output2 = gr.Audio(label="Output Audio")
|
79 |
vc_submit.click(vc_fn, [vc_input, vc_transform, auto_f0], [vc_output1, vc_output2])
|
80 |
+
if args.colab:
|
81 |
+
webbrowser.open("http://127.0.0.1:7860")
|
82 |
+
app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)
|