mateuseap commited on
Commit
7329ea0
·
1 Parent(s): cbc0833

feat(app.py): create download_models() function

Browse files
Files changed (1) hide show
  1. app.py +24 -10
app.py CHANGED
@@ -44,16 +44,30 @@ except (ValueError, TypeError, IndexError):
44
  DoFormant, Quefrency, Timbre = False, 1.0, 1.0
45
  CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, Quefrency, Timbre)
46
 
47
- # Download hubert base model if not present
48
- if not os.path.isfile('./hubert_base.pt'):
49
- response = requests.get('https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt')
50
-
51
- if response.status_code == 200:
52
- with open('./hubert_base.pt', 'wb') as f:
53
- f.write(response.content)
54
- print("Downloaded hubert base model file successfully. File saved to ./hubert_base.pt.")
55
- else:
56
- raise Exception("Failed to download hubert base model file. Status code: " + str(response.status_code) + ".")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  print("\n-------------------------------\nRVC v2 Easy GUI (Local Edition)\n-------------------------------\n")
59
 
 
44
  DoFormant, Quefrency, Timbre = False, 1.0, 1.0
45
  CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, Quefrency, Timbre)
46
 
47
+ def download_models():
48
+ # Download hubert base model if not present
49
+ if not os.path.isfile('./hubert_base.pt'):
50
+ response = requests.get('https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt')
51
+
52
+ if response.status_code == 200:
53
+ with open('./hubert_base.pt', 'wb') as f:
54
+ f.write(response.content)
55
+ print("Downloaded hubert base model file successfully. File saved to ./hubert_base.pt.")
56
+ else:
57
+ raise Exception("Failed to download hubert base model file. Status code: " + str(response.status_code) + ".")
58
+
59
+ # Download rmvpe model if not present
60
+ if not os.path.isfile('./rmvpe.pt'):
61
+ response = requests.get('https://drive.usercontent.google.com/download?id=1Hkn4kNuVFRCNQwyxQFRtmzmMBGpQxptI&export=download&authuser=0&confirm=t&uuid=0b3a40de-465b-4c65-8c41-135b0b45c3f7&at=APZUnTV3lA3LnyTbeuduura6Dmi2:1693724254058')
62
+
63
+ if response.status_code == 200:
64
+ with open('./rmvpe.pt', 'wb') as f:
65
+ f.write(response.content)
66
+ print("Downloaded hubert base model file successfully. File saved to ./rmvpe.pt.")
67
+ else:
68
+ raise Exception("Failed to download hubert base model file. Status code: " + str(response.status_code) + ".")
69
+
70
+ download_models()
71
 
72
  print("\n-------------------------------\nRVC v2 Easy GUI (Local Edition)\n-------------------------------\n")
73