Update app.py
Browse files
app.py
CHANGED
@@ -902,6 +902,19 @@ def download_model_files(model):
|
|
902 |
else:
|
903 |
return None, f'Could not find {model}.pth or corresponding Index file.'
|
904 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
905 |
with gr.Blocks(title="🔊",theme=gr.themes.Base(primary_hue="rose",neutral_hue="zinc")) as app:
|
906 |
with gr.Row():
|
907 |
gr.HTML("<img src='file/a.png' alt='image'>")
|
@@ -1347,18 +1360,25 @@ with gr.Blocks(title="🔊",theme=gr.themes.Base(primary_hue="rose",neutral_hue=
|
|
1347 |
value=i18n("是"),
|
1348 |
interactive=True,
|
1349 |
)
|
1350 |
-
|
|
|
|
|
|
|
|
|
1351 |
label=i18n("加载预训练底模G路径"),
|
1352 |
value="assets/pretrained_v2/f0G40k.pth",
|
|
|
1353 |
interactive=True,
|
1354 |
-
visible=
|
1355 |
)
|
1356 |
-
pretrained_D15 = gr.
|
1357 |
label=i18n("加载预训练底模D路径"),
|
1358 |
value="assets/pretrained_v2/f0D40k.pth",
|
1359 |
interactive=True,
|
1360 |
-
|
|
|
1361 |
)
|
|
|
1362 |
with gr.Row():
|
1363 |
download_model = gr.Button('5.Download Model')
|
1364 |
with gr.Row():
|
@@ -1438,4 +1458,4 @@ with gr.Blocks(title="🔊",theme=gr.themes.Base(primary_hue="rose",neutral_hue=
|
|
1438 |
inbrowser=not config.noautoopen,
|
1439 |
server_port=config.listen_port,
|
1440 |
quiet=True,
|
1441 |
-
)
|
|
|
902 |
else:
|
903 |
return None, f'Could not find {model}.pth or corresponding Index file.'
|
904 |
|
905 |
+
def update_visibility(visible):
|
906 |
+
if visible:
|
907 |
+
return {"visible":True,"__type__":"update"},{"visible":True,"__type__":"update"}
|
908 |
+
else:
|
909 |
+
return {"visible":False,"__type__":"update"},{"visible":False,"__type__":"update"}
|
910 |
+
|
911 |
+
def get_pretrains(string):
|
912 |
+
pretrains = []
|
913 |
+
for file in os.listdir('assets/pretrained_v2'):
|
914 |
+
if string in file:
|
915 |
+
pretrains.append(os.path.join('assets/pretrained_v2',file))
|
916 |
+
return pretrains
|
917 |
+
|
918 |
with gr.Blocks(title="🔊",theme=gr.themes.Base(primary_hue="rose",neutral_hue="zinc")) as app:
|
919 |
with gr.Row():
|
920 |
gr.HTML("<img src='file/a.png' alt='image'>")
|
|
|
1360 |
value=i18n("是"),
|
1361 |
interactive=True,
|
1362 |
)
|
1363 |
+
display_advanced_settings = gr.Checkbox(
|
1364 |
+
value=False,
|
1365 |
+
label="Advanced Settings"
|
1366 |
+
)
|
1367 |
+
pretrained_G14 = gr.Dropdown(
|
1368 |
label=i18n("加载预训练底模G路径"),
|
1369 |
value="assets/pretrained_v2/f0G40k.pth",
|
1370 |
+
choices=get_pretrains('40k'),
|
1371 |
interactive=True,
|
1372 |
+
visible=False
|
1373 |
)
|
1374 |
+
pretrained_D15 = gr.Dropdown(
|
1375 |
label=i18n("加载预训练底模D路径"),
|
1376 |
value="assets/pretrained_v2/f0D40k.pth",
|
1377 |
interactive=True,
|
1378 |
+
choices=get_pretrains('40k'),
|
1379 |
+
visible=False
|
1380 |
)
|
1381 |
+
display_advanced_settings.change(fn=update_visibility,inputs=[display_advanced_settings],outputs=[pretrained_G14,pretrained_D15])
|
1382 |
with gr.Row():
|
1383 |
download_model = gr.Button('5.Download Model')
|
1384 |
with gr.Row():
|
|
|
1458 |
inbrowser=not config.noautoopen,
|
1459 |
server_port=config.listen_port,
|
1460 |
quiet=True,
|
1461 |
+
)
|