mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-03-03 20:34:54 +08:00
Automatically select index file when model is selected (#894)
* automatically select index file when model is selected * Search for full directory of index file * Add trailing separator char to index search string * disable debug log * remove unused re --------- Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
This commit is contained in:
parent
0784b4e593
commit
144073a924
14
infer-web.py
14
infer-web.py
@ -399,6 +399,16 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format
|
|||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
yield "\n".join(infos)
|
yield "\n".join(infos)
|
||||||
|
|
||||||
|
def get_index_path_from_model(sid):
|
||||||
|
sel_index_path = ""
|
||||||
|
name = os.path.join("logs", sid.split(".")[0], "")
|
||||||
|
# print(name)
|
||||||
|
for f in index_paths:
|
||||||
|
if name in f:
|
||||||
|
# print("selected index path:", f)
|
||||||
|
sel_index_path = f
|
||||||
|
break
|
||||||
|
return sel_index_path
|
||||||
|
|
||||||
# 一个选项卡全局只能有一个音色
|
# 一个选项卡全局只能有一个音色
|
||||||
def get_vc(sid, to_return_protect0, to_return_protect1):
|
def get_vc(sid, to_return_protect0, to_return_protect1):
|
||||||
@ -434,6 +444,7 @@ def get_vc(sid, to_return_protect0, to_return_protect1):
|
|||||||
return {"visible": False, "__type__": "update"}
|
return {"visible": False, "__type__": "update"}
|
||||||
person = "%s/%s" % (weight_root, sid)
|
person = "%s/%s" % (weight_root, sid)
|
||||||
print("loading %s" % person)
|
print("loading %s" % person)
|
||||||
|
|
||||||
cpt = torch.load(person, map_location="cpu")
|
cpt = torch.load(person, map_location="cpu")
|
||||||
tgt_sr = cpt["config"][-1]
|
tgt_sr = cpt["config"][-1]
|
||||||
cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
|
cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
|
||||||
@ -479,6 +490,7 @@ def get_vc(sid, to_return_protect0, to_return_protect1):
|
|||||||
{"visible": True, "maximum": n_spk, "__type__": "update"},
|
{"visible": True, "maximum": n_spk, "__type__": "update"},
|
||||||
to_return_protect0,
|
to_return_protect0,
|
||||||
to_return_protect1,
|
to_return_protect1,
|
||||||
|
get_index_path_from_model(sid),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -1629,7 +1641,7 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
sid0.change(
|
sid0.change(
|
||||||
fn=get_vc,
|
fn=get_vc,
|
||||||
inputs=[sid0, protect0, protect1],
|
inputs=[sid0, protect0, protect1],
|
||||||
outputs=[spk_item, protect0, protect1],
|
outputs=[spk_item, protect0, protect1, file_index2],
|
||||||
)
|
)
|
||||||
with gr.TabItem(i18n("伴奏人声分离&去混响&去回声")):
|
with gr.TabItem(i18n("伴奏人声分离&去混响&去回声")):
|
||||||
with gr.Group():
|
with gr.Group():
|
||||||
|
Loading…
Reference in New Issue
Block a user