Spaces:
Runtime error
Runtime error
Update app.py
Browse files5 unmodified lines678910113 unmodified lines1516171819202122232425262723 unmodified lines515253545556164 unmodified lines2212222232242252265 unmodified linesimport loggingimport timeimport soundfile as sfPITCH_ALGO_OPT = ["pm",3 unmodified lines"rmvpe+",]logging.getLogger("infer_rvc_python").setLevel(logging.ERROR)converter = BaseLoader(only_cpu=False, hubert_path=None, rmvpe_path=None)title = "<center><strong><font size='7'>RVC⚡ZERO</font></strong></center>"description = "This demo is provided for educational and research purposes only. The authors and contributors of this project do not endorse or encourage any misuse or unethical use of this software. Any use of this software for purposes other than those intended is solely at the user's own risk. The authors and contributors shall not be held responsible for any damages or liabilities arising from the use of this demo inappropriately."theme = "aliabid94/new-theme"@spaces.GPU()23 unmodified linesif isinstance(audio_files, str):audio_files = [audio_files]random_tag = "USER_"+str(random.randint(10000000, 99999999))converter.apply_conf(164 unmodified lines0.25,0.50,],],fn=run,inputs=[5 unmodified lines67891011121314151617181920213 unmodified lines25262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959623 unmodified lines120121122123124125126127128129164 unmodified lines2942952962972982993003013023033043053063073083093103113123133143153163173183193203213225 unmodified linesimport loggingimport timeimport soundfile as sffrom infer_rvc_python.main import download_managerimport zipfilelogging.getLogger("infer_rvc_python").setLevel(logging.ERROR)converter = BaseLoader(only_cpu=False, hubert_path=None, rmvpe_path=None)title = "<center><strong><font size='7'>RVC⚡ZERO</font></strong></center>"description = "This demo is provided for educational and research purposes only. The authors and contributors of this project do not endorse or encourage any misuse or unethical use of this software. Any use of this software for purposes other than those intended is solely at the user's own risk. The authors and contributors shall not be held responsible for any damages or liabilities arising from the use of this demo inappropriately."theme = "aliabid94/new-theme"PITCH_ALGO_OPT = ["pm",3 unmodified lines"rmvpe+",]def find_files(directory):file_paths = []for filename in os.listdir(directory):# Check if the file has the desired extensionif filename.endswith('.pth') or filename.endswith('.zip') or filename.endswith('.index'):# If yes, add the file path to the listfile_paths.append(os.path.join(directory, filename))return file_pathsdef unzip_in_folder(my_zip, my_dir):with zipfile.ZipFile(my_zip) as zip:for zip_info in zip.infolist():if zip_info.is_dir():continuezip_info.filename = os.path.basename(zip_info.filename)zip.extract(zip_info, my_dir)def find_my_model(a_, b_):if a_ is None or a_.endswith(".pth"):return a_, b_txt_files = []for base_file in [a_, b_]:if base_file is not None and base_file.endswith(".txt"):txt_files.append(base_file)directory = os.path.dirname(a_)for txt in txt_files:with open(txt, 'r') as file:first_line = file.readline()download_manager(url=first_line.strip(),path=directory,extension="",)for f in find_files(directory):if f.endswith(".zip"):unzip_in_folder(f, directory)model = Noneindex = Noneend_files = find_files(directory)for ff in end_files:if ff.endswith(".pth"):model = os.path.join(directory, ff)gr.Info(f"Model found: {ff}")if ff.endswith(".index"):index = os.path.join(directory, ff)gr.Info(f"Index found: {ff}")if not model:gr.Error(f"Model not found in: {end_files}")if not index:gr.Warning("Index not found")return model, index@spaces.GPU()23 unmodified linesif isinstance(audio_files, str):audio_files = [audio_files]if file_m is not None and file_m.endswith(".txt"):file_m, file_index = find_my_model(file_m, file_index)print(file_m, file_index)random_tag = "USER_"+str(random.randint(10000000, 99999999))converter.apply_conf(164 unmodified lines0.25,0.50,],[["./example2/test2.ogg"],"./example2/model_link.txt","rmvpe+",0,"./example2/index_link.txt",0.75,3,0.25,0.50,],[["./example3/test3.wav"],"./example3/zip_link.txt","rmvpe+",0,None,0.75,3,0.25,0.50,],],fn=run,inputs=[
app.py+101-5