Spaces:
Runtime error
Runtime error
| import os | |
| # import gradio as gr | |
| # import spaces | |
| from infer_rvc_python import BaseLoader | |
| import random | |
| import logging | |
| import time | |
| import soundfile as sf | |
| from infer_rvc_python.main import download_manager | |
| import zipfile | |
| converter = BaseLoader( | |
| only_cpu=True, hubert_path="./hubert_base.pt", rmvpe_path="./rmvpe.pt" | |
| ) | |
| def main(): | |
| audio_out = run( | |
| ["super-shy-mdx.mp3"], | |
| "test.pth", | |
| "rmvpe+", | |
| -12, | |
| "added_IVF839_Flat_nprobe_1_test_v2.index", | |
| 0.75, # index_influence | |
| 3, # respiration_median_filtering, | |
| 0.25, # envelope_ratio, | |
| 0.5, # consonant_breath_protection | |
| ) | |
| def convert_now(audio_files, random_tag, converter): | |
| return converter(audio_files, random_tag, overwrite=False, parallel_workers=0) | |
| def run( | |
| audio_files, | |
| file_m, | |
| pitch_alg, | |
| pitch_lvl, | |
| file_index, | |
| index_inf, | |
| r_m_f, | |
| e_r, | |
| c_b_p, | |
| ): | |
| random_tag = "USER_" + str(random.randint(10000000, 99999999)) | |
| converter.apply_conf( | |
| tag=random_tag, | |
| file_model=file_m, | |
| pitch_algo=pitch_alg, | |
| pitch_lvl=pitch_lvl, | |
| file_index=file_index, | |
| index_influence=index_inf, | |
| respiration_median_filtering=r_m_f, | |
| envelope_ratio=e_r, | |
| consonant_breath_protection=c_b_p, | |
| resample_sr=44100 if audio_files[0].endswith(".mp3") else 0, | |
| ) | |
| return convert_now(audio_files, random_tag, converter) | |
| if __name__ == "__main__": | |
| main() |