Spaces:
Running
Running
Update src/modules/model_management.py
Browse files
src/modules/model_management.py
CHANGED
@@ -101,5 +101,25 @@ def upload_zip_model(zip_path, dir_name, progress=gr.Progress()):
|
|
101 |
extract_zip(extraction_folder, zip_name)
|
102 |
return f'[+] The {dir_name} model was loaded successfully!'
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
except Exception as e:
|
105 |
raise gr.Error(str(e))
|
|
|
101 |
extract_zip(extraction_folder, zip_name)
|
102 |
return f'[+] The {dir_name} model was loaded successfully!'
|
103 |
|
104 |
+
except Exception as e:
|
105 |
+
raise gr.Error(str(e))
|
106 |
+
|
107 |
+
def upload_separate_files(pth_file, index_file, dir_name, progress=gr.Progress()):
|
108 |
+
try:
|
109 |
+
extraction_folder = os.path.join(rvc_models_dir, dir_name)
|
110 |
+
if os.path.exists(extraction_folder):
|
111 |
+
raise gr.Error(f'The voice model directory {dir_name} already exists! Choose a different name for your voice model.')
|
112 |
+
|
113 |
+
os.makedirs(extraction_folder, exist_ok=True)
|
114 |
+
|
115 |
+
if pth_file:
|
116 |
+
pth_path = os.path.join(extraction_folder, os.path.basename(pth_file.name))
|
117 |
+
shutil.copyfile(pth_file.name, pth_path)
|
118 |
+
|
119 |
+
if index_file:
|
120 |
+
index_path = os.path.join(extraction_folder, os.path.basename(index_file.name))
|
121 |
+
shutil.copyfile(index_file.name, index_path)
|
122 |
+
|
123 |
+
return f'[+] The {dir_name} model was loaded successfully!'
|
124 |
except Exception as e:
|
125 |
raise gr.Error(str(e))
|