Spaces:
LaynzID12
/
Runtime error

File size: 8,626 Bytes
7bc29af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
@echo off
title Applio Installer

:::                       _ _         _____                    _      
:::     /\               | (_)       |  __ \                  | |     
:::    /  \   _ __  _ __ | |_  ___   | |__) |___  ___ ___   __| | ___ 
:::   / /\ \ | '_ \| '_ \| | |/ _ \  |  _  // _ \/ __/ _ \ / _` |/ _ \
:::  / ____ \| |_) | |_) | | | (_) | | | \ \  __/ (_| (_) | (_| |  __/
::: /_/    \_\ .__/| .__/|_|_|\___/  |_|  \_\___|\___\___/ \__,_|\___|
:::          | |   | |                                                
:::          |_|   |_|                                                
:::
:::

setlocal 
set "branch=applio-recode"
set "runtime=runtime-recode"
set "repoUrl=https://github.com/IAHispano/Applio-RVC-Fork/archive/refs/heads/%branch%.zip"
set "fixesFolder=fixes"
set "localFixesPy=local_fixes.py"
set "principal=%cd%"
set "URL_BASE=https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main"
set "URL_EXTRA=https://huggingface.co/IAHispano/applio/resolve/main"

:menu
for /f "delims=: tokens=*" %%A in ('findstr /b ":::" "%~f0"') do @echo(%%A

echo [1] Reinstall Applio
echo [2] Update Applio
echo [3] Update Applio + Runtime
echo.

set /p choice=Select an option: 
set choice=%choice: =%

if "%choice%"=="1" (
    cls
    echo Starting Applio Reinstaller...
    echo.
    goto reinstaller
    pause
    cls
    goto menu

)

if "%choice%"=="2" (
    cls
    echo Starting Applio Updater...
    echo.
    goto updater
    pause
    cls
    goto menu
)

if "%choice%"=="3" (
    cls
    echo Updating Applio + Runtime...
    echo.
    goto updaterRuntime
    pause
    cls
    goto menu

)

cls
echo Invalid option. Please enter a number from 1 to 3.
echo.
echo Press 'Enter' to access the main menu...
pause>nul
cls
goto menu

:reinstaller

echo WARNING: Remember to install Microsoft C++ Build Tools, Redistributable, Python, and Git before continuing.
echo.
echo Step-by-step guide: https://rentry.org/appliolocal
echo Build Tools: https://aka.ms/vs/17/release/vs_BuildTools.exe
echo Redistributable: https://aka.ms/vs/17/release/vc_redist.x64.exe
echo Git: https://github.com/git-for-windows/git/releases/download/v2.42.0.windows.2/Git-2.42.0.2-64-bit.exe
echo Python: Add this route to the windows enviroment variables the user path variable: %principal%\runtime\Scripts
echo.
pause
cls

echo Downloading ZIP file...
powershell -command "& { Invoke-WebRequest -Uri '%repoUrl%' -OutFile '%principal%\repo.zip' }"
echo.

echo Extracting ZIP file...
powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('%principal%\repo.zip', '%principal%') }"
echo.

echo Copying folder and file structure from subdirectory to main directory...
robocopy "%principal%\Applio-RVC-Fork-%branch%" "%principal%" /E
echo.

echo Deleting contents of subdirectory (files and folders)...
rmdir "%principal%\Applio-RVC-Fork-%branch%" /S /Q
echo.

echo Cleaning up...
del "%principal%\repo.zip"
echo.
cls

echo Proceeding to download the models...
echo.

echo WARNING: At this point, it's recommended to disable antivirus or firewall, as errors might occur when downloading pretrained models.
pause
cls

echo Downloading models in the assets folder...
cd "assets"
echo.
echo Downloading the "pretrained" folder...
cd "pretrained"
curl -LJO "%URL_BASE%/pretrained/D32k.pth"
curl -LJO "%URL_BASE%/pretrained/D40k.pth"
curl -LJO "%URL_BASE%/pretrained/D48k.pth"
curl -LJO "%URL_BASE%/pretrained/G32k.pth"
curl -LJO "%URL_BASE%/pretrained/G40k.pth"
curl -LJO "%URL_BASE%/pretrained/G48k.pth"
curl -LJO "%URL_BASE%/pretrained/f0D32k.pth"
curl -LJO "%URL_BASE%/pretrained/f0D40k.pth"
curl -LJO "%URL_BASE%/pretrained/f0D48k.pth"
curl -LJO "%URL_BASE%/pretrained/f0G32k.pth"
curl -LJO "%URL_BASE%/pretrained/f0G40k.pth"
curl -LJO "%URL_BASE%/pretrained/f0G48k.pth"
cd ".."
echo.
cls

echo Downloading the "pretrained_v2" folder...
cd "pretrained_v2"
curl -LJO "%URL_BASE%/pretrained_v2/D32k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/D40k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/D48k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/G32k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/G40k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/G48k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/f0D32k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/f0D40k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/f0D48k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/f0G32k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/f0G40k.pth"
curl -LJO "%URL_BASE%/pretrained_v2/f0G48k.pth"
cd ".."
echo.
cls

echo Downloading the hubert_base.pt file...
cd "hubert"
curl -LJO "%URL_BASE%/hubert_base.pt"
cd ".."
echo.
cls


echo Downloading the rmvpe.pt file...
cd "rmvpe"
curl -LJO "%URL_BASE%/rmvpe.pt"
echo.
cls

echo Downloading the rmvpe.onnx file...
curl -LJO "%URL_BASE%/rmvpe.onnx"
cd ".."
cd ".."
echo.
cls

echo Downloading the rest of the large files

echo Downloading the "uvr5_weights" folder...
cd "uvr5_weights"
curl -LJO "%URL_BASE%/uvr5_weights/HP2_all_vocals.pth"
curl -LJO "%URL_BASE%/uvr5_weights/HP3_all_vocals.pth"
curl -LJO "%URL_BASE%/uvr5_weights/HP5_only_main_vocal.pth"
curl -LJO "%URL_BASE%/uvr5_weights/VR-DeEchoAggressive.pth"
curl -LJO "%URL_BASE%/uvr5_weights/VR-DeEchoDeReverb.pth"
curl -LJO "%URL_BASE%/uvr5_weights/VR-DeEchoNormal.pth"
cd ".."
echo.
cls

echo Downloading the ffmpeg.exe file...
curl -LJO "%URL_BASE%/ffmpeg.exe"
echo.
cls

echo Downloading the ffprobe.exe file...
curl -LJO "%URL_BASE%/ffprobe.exe"
echo.
cls

echo Downloading the runtime.zip file...
curl -LJO "%URL_EXTRA%/%runtime%.zip"
echo.
cls

echo Extracting the runtime.zip file, this might take a while...
powershell -Command "Expand-Archive -Path '%runtime%.zip' -DestinationPath '.'"
del %runtime%.zip
echo.
cls

echo Downloads completed!
echo.

echo Checking if the local_fixes.py file exists in the Fixes folder...
if exist "%fixesFolder%\%localFixesPy%" (
    echo Running the file...
    runtime\python.exe "%fixesFolder%\%localFixesPy%"
) else (
    echo The "%localFixesPy%" file was not found in the "Fixes" folder.
)
echo.

echo Fixes Applied!
echo.

echo Applio has been reinstalled!
echo.
echo Press 'Enter' to access the main menu...
pause>nul
cls
goto menu


:updater

echo Downloading the ZIP file...
powershell -command "& { Invoke-WebRequest -Uri '%repoUrl%' -OutFile '%principal%\repo.zip' }"
echo.

echo Extracting ZIP file...
powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('%principal%\repo.zip', '%principal%') }"
echo.

echo Copying folder and file structure from subdirectory to main directory...
robocopy "%principal%\Applio-RVC-Fork-%branch%" "%principal%" /E
echo.

echo Deleting contents of the subdirectory (files and folders)...
rmdir "%principal%\Applio-RVC-Fork-%branch%" /S /Q
echo.

echo Cleaning up...
del "%principal%\repo.zip"
echo.
cls

echo Verifying if the local_fixes.py file exists in the Fixes folder...
if exist "%fixesFolder%\%localFixesPy%" (
    echo Running the file...
    runtime\python.exe "%fixesFolder%\%localFixesPy%"
) else (
    echo The file "%localFixesPy%" was not found in the "Fixes" folder.
)
echo.

echo Applio has been updated!
echo.
echo Press 'Enter' to access the main menu... 
pause>nul
cls
goto menu


:updaterRuntime

echo Downloading the ZIP file...
powershell -command "& { Invoke-WebRequest -Uri '%repoUrl%' -OutFile '%principal%\repo.zip' }"
echo.

echo Extracting ZIP file...
powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('%principal%\repo.zip', '%principal%') }"
echo.

echo Copying folder and file structure from subdirectory to main directory...
robocopy "%principal%\Applio-RVC-Fork-%branch%" "%principal%" /E
echo.

echo Deleting contents of the subdirectory (files and folders)...
rmdir "%principal%\Applio-RVC-Fork-%branch%" /S /Q
echo.

echo Cleaning up...
del "%principal%\repo.zip"
echo.
cls

echo Downloading the runtime.zip file...
curl -LJO "%URL_EXTRA%/%runtime%.zip"
echo.
cls
echo Extracting the runtime.zip file, this might take a while...
powershell -Command "Expand-Archive -Path '%runtime%.zip' -DestinationPath '.'"
del runtime.zip
echo.
cls

echo Verifying if the local_fixes.py file exists in the Fixes folder...
if exist "%fixesFolder%\%localFixesPy%" (
    echo Running the file...
    runtime\python.exe "%fixesFolder%\%localFixesPy%"
) else (
    echo The file "%localFixesPy%" was not found in the "Fixes" folder.
)
echo.

echo Applio has been updated!
echo.
echo Press 'Enter' to access the main menu...
pause>nul
cls
goto menu