Spaces:
Runtime error
Runtime error
DJQmUKV
commited on
Commit
·
ee904a2
1
Parent(s):
10ed4c9
chore: remove argument parsing
Browse files- app_multi.py +8 -51
app_multi.py
CHANGED
|
@@ -24,45 +24,6 @@ from infer_pack.models import (
|
|
| 24 |
from vc_infer_pipeline import VC
|
| 25 |
|
| 26 |
|
| 27 |
-
# Argument parsing
|
| 28 |
-
arg_parser = ArgumentParser()
|
| 29 |
-
arg_parser.add_argument(
|
| 30 |
-
'--hubert',
|
| 31 |
-
default='hubert_base.pt',
|
| 32 |
-
help='path to hubert base model (default: hubert_base.pt)'
|
| 33 |
-
)
|
| 34 |
-
arg_parser.add_argument(
|
| 35 |
-
'--config',
|
| 36 |
-
default='multi_config.json',
|
| 37 |
-
help='path to config file (default: multi_config.json)'
|
| 38 |
-
)
|
| 39 |
-
arg_parser.add_argument(
|
| 40 |
-
'--bind',
|
| 41 |
-
default='127.0.0.1',
|
| 42 |
-
help='gradio server listen address (default: 127.0.0.1)'
|
| 43 |
-
)
|
| 44 |
-
arg_parser.add_argument(
|
| 45 |
-
'--port',
|
| 46 |
-
default=7860,
|
| 47 |
-
help='gradio server listen port (default: 7860)'
|
| 48 |
-
)
|
| 49 |
-
arg_parser.add_argument(
|
| 50 |
-
'--share',
|
| 51 |
-
action='store_true',
|
| 52 |
-
help='let gradio create a public link for you'
|
| 53 |
-
)
|
| 54 |
-
arg_parser.add_argument(
|
| 55 |
-
'--api',
|
| 56 |
-
action='store_true',
|
| 57 |
-
help='enable api endpoint'
|
| 58 |
-
)
|
| 59 |
-
arg_parser.add_argument(
|
| 60 |
-
'--cache-examples',
|
| 61 |
-
action='store_true',
|
| 62 |
-
help='enable example caching, please remember delete gradio_cached_examples folder when example config has been modified' # noqa
|
| 63 |
-
)
|
| 64 |
-
args = arg_parser.parse_args()
|
| 65 |
-
|
| 66 |
app_css = '''
|
| 67 |
#model_info img {
|
| 68 |
max-width: 100px;
|
|
@@ -82,11 +43,11 @@ app = gr.Blocks(
|
|
| 82 |
)
|
| 83 |
|
| 84 |
# Load hubert model
|
| 85 |
-
hubert_model = util.load_hubert_model(device,
|
| 86 |
hubert_model.eval()
|
| 87 |
|
| 88 |
# Load models
|
| 89 |
-
multi_cfg = json.load(open(
|
| 90 |
loaded_models = []
|
| 91 |
|
| 92 |
for model_name in multi_cfg.get('models'):
|
|
@@ -360,8 +321,8 @@ with app:
|
|
| 360 |
],
|
| 361 |
outputs=[output_audio, output_msg, model_info],
|
| 362 |
fn=_example_vc,
|
| 363 |
-
cache_examples=
|
| 364 |
-
run_on_click=
|
| 365 |
)
|
| 366 |
|
| 367 |
# Edge TTS Example
|
|
@@ -375,8 +336,8 @@ with app:
|
|
| 375 |
],
|
| 376 |
outputs=[output_audio, output_msg, model_info],
|
| 377 |
fn=_example_edge_tts,
|
| 378 |
-
cache_examples=
|
| 379 |
-
run_on_click=
|
| 380 |
)
|
| 381 |
|
| 382 |
vc_convert_btn.click(
|
|
@@ -407,9 +368,5 @@ with app:
|
|
| 407 |
app.queue(
|
| 408 |
concurrency_count=1,
|
| 409 |
max_size=20,
|
| 410 |
-
api_open=
|
| 411 |
-
).launch(
|
| 412 |
-
server_name=args.bind,
|
| 413 |
-
server_port=args.port,
|
| 414 |
-
share=args.share
|
| 415 |
-
)
|
|
|
|
| 24 |
from vc_infer_pipeline import VC
|
| 25 |
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
app_css = '''
|
| 28 |
#model_info img {
|
| 29 |
max-width: 100px;
|
|
|
|
| 43 |
)
|
| 44 |
|
| 45 |
# Load hubert model
|
| 46 |
+
hubert_model = util.load_hubert_model(device, 'hubert_base.pt')
|
| 47 |
hubert_model.eval()
|
| 48 |
|
| 49 |
# Load models
|
| 50 |
+
multi_cfg = json.load(open('multi_config.json', 'r'))
|
| 51 |
loaded_models = []
|
| 52 |
|
| 53 |
for model_name in multi_cfg.get('models'):
|
|
|
|
| 321 |
],
|
| 322 |
outputs=[output_audio, output_msg, model_info],
|
| 323 |
fn=_example_vc,
|
| 324 |
+
cache_examples=False,
|
| 325 |
+
run_on_click=False
|
| 326 |
)
|
| 327 |
|
| 328 |
# Edge TTS Example
|
|
|
|
| 336 |
],
|
| 337 |
outputs=[output_audio, output_msg, model_info],
|
| 338 |
fn=_example_edge_tts,
|
| 339 |
+
cache_examples=False,
|
| 340 |
+
run_on_click=False
|
| 341 |
)
|
| 342 |
|
| 343 |
vc_convert_btn.click(
|
|
|
|
| 368 |
app.queue(
|
| 369 |
concurrency_count=1,
|
| 370 |
max_size=20,
|
| 371 |
+
api_open=False
|
| 372 |
+
).launch()
|
|
|
|
|
|
|
|
|
|
|
|