Skip to content

Commit 9f7fe29

Browse files
authored
Add REST API settings (#887)
1 parent 0b15d48 commit 9f7fe29

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

infer-web.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ def export_onnx(ModelPath, ExportedPath):
13941394
visible=False,
13951395
interactive=True,
13961396
)
1397-
clean_button.click(fn=clean, inputs=[], outputs=[sid0])
1397+
clean_button.click(fn=clean, inputs=[], outputs=[sid0], api_name="infer_clean")
13981398
with gr.Group():
13991399
gr.Markdown(
14001400
value=i18n("男转女推荐+12key, 女转男推荐-12key, 如果音域爆炸导致音色失真也可以自己调整到合适音域. ")
@@ -1436,7 +1436,7 @@ def export_onnx(ModelPath, ExportedPath):
14361436
interactive=True,
14371437
)
14381438
refresh_button.click(
1439-
fn=change_choices, inputs=[], outputs=[sid0, file_index2]
1439+
fn=change_choices, inputs=[], outputs=[sid0, file_index2], api_name="infer_refresh"
14401440
)
14411441
# file_big_npy1 = gr.Textbox(
14421442
# label=i18n("特征文件路径"),
@@ -1499,6 +1499,7 @@ def export_onnx(ModelPath, ExportedPath):
14991499
protect0,
15001500
],
15011501
[vc_output1, vc_output2],
1502+
api_name="infer_convert",
15021503
)
15031504
with gr.Group():
15041505
gr.Markdown(
@@ -1541,6 +1542,7 @@ def export_onnx(ModelPath, ExportedPath):
15411542
fn=lambda: change_choices()[1],
15421543
inputs=[],
15431544
outputs=file_index4,
1545+
api_name="infer_refresh_batch",
15441546
)
15451547
# file_big_npy2 = gr.Textbox(
15461548
# label=i18n("特征文件路径"),
@@ -1617,6 +1619,7 @@ def export_onnx(ModelPath, ExportedPath):
16171619
format1,
16181620
],
16191621
[vc_output3],
1622+
api_name="infer_convert_batch",
16201623
)
16211624
sid0.change(
16221625
fn=get_vc,
@@ -1676,6 +1679,7 @@ def export_onnx(ModelPath, ExportedPath):
16761679
format0,
16771680
],
16781681
[vc_output4],
1682+
api_name="uvr_convert",
16791683
)
16801684
with gr.TabItem(i18n("训练")):
16811685
gr.Markdown(
@@ -1733,7 +1737,7 @@ def export_onnx(ModelPath, ExportedPath):
17331737
but1 = gr.Button(i18n("处理数据"), variant="primary")
17341738
info1 = gr.Textbox(label=i18n("输出信息"), value="")
17351739
but1.click(
1736-
preprocess_dataset, [trainset_dir4, exp_dir1, sr2, np7], [info1]
1740+
preprocess_dataset, [trainset_dir4, exp_dir1, sr2, np7], [info1], api_name="train_preprocess"
17371741
)
17381742
with gr.Group():
17391743
gr.Markdown(value=i18n("step2b: 使用CPU提取音高(如果模型带音高), 使用GPU提取特征(选择卡号)"))
@@ -1781,6 +1785,7 @@ def export_onnx(ModelPath, ExportedPath):
17811785
gpus_rmvpe,
17821786
],
17831787
[info2],
1788+
api_name="train_extract_f0_feature",
17841789
)
17851790
with gr.Group():
17861791
gr.Markdown(value=i18n("step3: 填写训练设置, 开始训练模型和索引"))
@@ -1883,6 +1888,7 @@ def export_onnx(ModelPath, ExportedPath):
18831888
version19,
18841889
],
18851890
info3,
1891+
api_name="train_start",
18861892
)
18871893
but4.click(train_index, [exp_dir1, version19], info3)
18881894
but5.click(
@@ -1908,6 +1914,7 @@ def export_onnx(ModelPath, ExportedPath):
19081914
gpus_rmvpe,
19091915
],
19101916
info3,
1917+
api_name="train_start_all",
19111918
)
19121919

19131920
with gr.TabItem(i18n("ckpt处理")):
@@ -1967,6 +1974,7 @@ def export_onnx(ModelPath, ExportedPath):
19671974
version_2,
19681975
],
19691976
info4,
1977+
api_name="ckpt_merge",
19701978
) # def merge(path1,path2,alpha1,sr,f0,info):
19711979
with gr.Group():
19721980
gr.Markdown(value=i18n("修改模型信息(仅支持weights文件夹下提取的小模型文件)"))
@@ -1986,7 +1994,7 @@ def export_onnx(ModelPath, ExportedPath):
19861994
with gr.Row():
19871995
but7 = gr.Button(i18n("修改"), variant="primary")
19881996
info5 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
1989-
but7.click(change_info, [ckpt_path0, info_, name_to_save1], info5)
1997+
but7.click(change_info, [ckpt_path0, info_, name_to_save1], info5, api_name="ckpt_modify")
19901998
with gr.Group():
19911999
gr.Markdown(value=i18n("查看模型信息(仅支持weights文件夹下提取的小模型文件)"))
19922000
with gr.Row():
@@ -1995,7 +2003,7 @@ def export_onnx(ModelPath, ExportedPath):
19952003
)
19962004
but8 = gr.Button(i18n("查看"), variant="primary")
19972005
info6 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
1998-
but8.click(show_info, [ckpt_path1], info6)
2006+
but8.click(show_info, [ckpt_path1], info6, api_name="ckpt_show")
19992007
with gr.Group():
20002008
gr.Markdown(
20012009
value=i18n(
@@ -2041,6 +2049,7 @@ def export_onnx(ModelPath, ExportedPath):
20412049
extract_small_model,
20422050
[ckpt_path2, save_name, sr__, if_f0__, info___, version_1],
20432051
info7,
2052+
api_name="ckpt_extract",
20442053
)
20452054

20462055
with gr.TabItem(i18n("Onnx导出")):
@@ -2054,7 +2063,7 @@ def export_onnx(ModelPath, ExportedPath):
20542063
infoOnnx = gr.Label(label="info")
20552064
with gr.Row():
20562065
butOnnx = gr.Button(i18n("导出Onnx模型"), variant="primary")
2057-
butOnnx.click(export_onnx, [ckpt_dir, onnx_dir], infoOnnx)
2066+
butOnnx.click(export_onnx, [ckpt_dir, onnx_dir], infoOnnx, api_name="export_onnx")
20582067

20592068
tab_faq = i18n("常见问题解答")
20602069
with gr.TabItem(tab_faq):

0 commit comments

Comments
 (0)