Skip to content

Commit 296f1f7

Browse files
authored
Clean Path (RVC-Boss#1299)
* clean path * clean path
1 parent 24deae6 commit 296f1f7

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

tools/my_utils.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ def load_audio(file, sr):
2525
return np.frombuffer(out, np.float32).flatten()
2626

2727

28-
def clean_path(path_str):
28+
def clean_path(path_str:str):
29+
if path_str.endswith(('\\','/')):
30+
return clean_path(path_str[0:-1])
2931
if platform.system() == 'Windows':
3032
path_str = path_str.replace('/', '\\')
31-
return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a")
33+
return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a")

tools/uvr5/webui.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import traceback,gradio as gr
33
import logging
44
from tools.i18n.i18n import I18nAuto
5+
from tools.my_utils import clean_path
56
i18n = I18nAuto()
67

78
logger = logging.getLogger(__name__)
@@ -26,13 +27,9 @@
2627
def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format0):
2728
infos = []
2829
try:
29-
inp_root = inp_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
30-
save_root_vocal = (
31-
save_root_vocal.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
32-
)
33-
save_root_ins = (
34-
save_root_ins.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
35-
)
30+
inp_root = clean_path(inp_root)
31+
save_root_vocal = clean_path(save_root_vocal)
32+
save_root_ins = clean_path(save_root_ins)
3633
is_hp3 = "HP3" in model_name
3734
if model_name == "onnx_dereverb_By_FoxJoy":
3835
pre_fun = MDXNetDereverb(15)

webui.py

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def open_asr(asr_inp_dir, asr_opt_dir, asr_model, asr_model_size, asr_lang):
199199
global p_asr
200200
if(p_asr==None):
201201
asr_inp_dir=my_utils.clean_path(asr_inp_dir)
202+
asr_opt_dir=my_utils.clean_path(asr_opt_dir)
202203
cmd = f'"{python_exec}" tools/asr/{asr_dict[asr_model]["path"]}'
203204
cmd += f' -i "{asr_inp_dir}"'
204205
cmd += f' -o "{asr_opt_dir}"'

0 commit comments

Comments
 (0)