Boka73 commited on
Commit
67e07b3
·
verified ·
1 Parent(s): 320a25f

create windows_run

Browse files
Files changed (1) hide show
  1. installer/windows_run +95 -0
installer/windows_run ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ REM No CLI arguments supported anymore
4
+ set COMMANDLINE_ARGS=
5
+
6
+ cd /D "%~dp0"
7
+
8
+ echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end
9
+
10
+ set PATH=%PATH%;%SystemRoot%\system32
11
+
12
+ @rem config
13
+ set INSTALL_DIR=%cd%\installer_files
14
+ set CONDA_ROOT_PREFIX=%cd%\installer_files\conda
15
+ set INSTALL_ENV_DIR=%cd%\installer_files\env
16
+ set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
17
+ set FFMPEG_DOWNLOAD_URL=https://github.com/GyanD/codexffmpeg/releases/download/7.1/ffmpeg-7.1-essentials_build.zip
18
+ set INSTALL_FFMPEG_DIR=%cd%\installer_files\ffmpeg
19
+ set INSIGHTFACE_PACKAGE_URL=https://github.com/Gourieff/Assets/raw/refs/heads/main/Insightface/insightface-0.7.3-cp310-cp310-win_amd64.whl
20
+ set INSIGHTFACE_PACKAGE_PATH=%INSTALL_DIR%\insightface-0.7.3-cp310-cp310-win_amd64.whl
21
+
22
+ set conda_exists=F
23
+ set ffmpeg_exists=F
24
+
25
+ @rem figure out whether git and conda needs to be installed
26
+ call "%CONDA_ROOT_PREFIX%\_conda.exe" --version >nul 2>&1
27
+ if "%ERRORLEVEL%" EQU "0" set conda_exists=T
28
+
29
+ @rem Check if FFmpeg is already in PATH
30
+ where ffmpeg >nul 2>&1
31
+ if "%ERRORLEVEL%" EQU "0" (
32
+ echo FFmpeg is already installed.
33
+ set ffmpeg_exists=T
34
+ )
35
+
36
+ @rem (if necessary) install git and conda into a contained environment
37
+
38
+ @rem download conda
39
+ if "%conda_exists%" == "F" (
40
+ echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL% to %INSTALL_DIR%\miniconda_installer.exe
41
+ mkdir "%INSTALL_DIR%"
42
+ call curl -Lk "%MINICONDA_DOWNLOAD_URL%" > "%INSTALL_DIR%\miniconda_installer.exe" || ( echo. && echo Miniconda failed to download. && goto end )
43
+ echo Installing Miniconda to %CONDA_ROOT_PREFIX%
44
+ start /wait "" "%INSTALL_DIR%\miniconda_installer.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%CONDA_ROOT_PREFIX%
45
+
46
+ @rem test the conda binary
47
+ echo Miniconda version:
48
+ call "%CONDA_ROOT_PREFIX%\_conda.exe" --version || ( echo. && echo Miniconda not found. && goto end )
49
+ )
50
+
51
+ @rem create the installer env
52
+ if not exist "%INSTALL_ENV_DIR%" (
53
+ echo Creating Conda Environment
54
+ call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.10 || ( echo. && echo ERROR: Conda environment creation failed. && goto end )
55
+ @rem check if conda environment was actually created
56
+ if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo ERROR: Conda environment is empty. && goto end )
57
+ @rem activate installer env
58
+ call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo ERROR: Miniconda hook not found. && goto end )
59
+ @rem Download insightface package
60
+ echo Downloading insightface package from %INSIGHTFACE_PACKAGE_URL% to %INSIGHTFACE_PACKAGE_PATH%
61
+ call curl -Lk "%INSIGHTFACE_PACKAGE_URL%" > "%INSIGHTFACE_PACKAGE_PATH%" || ( echo. && echo ERROR: Insightface package failed to download. && goto end )
62
+ @rem install insightface package using pip
63
+ echo Installing insightface package
64
+ call pip install "%INSIGHTFACE_PACKAGE_PATH%" || ( echo. && echo ERROR: Insightface package installation failed. && goto end )
65
+ )
66
+
67
+ @rem Download and install FFmpeg if not already installed
68
+ if "%ffmpeg_exists%" == "F" (
69
+ if not exist "%INSTALL_FFMPEG_DIR%" (
70
+ echo Downloading ffmpeg from %FFMPEG_DOWNLOAD_URL% to %INSTALL_DIR%
71
+ call curl -Lk "%FFMPEG_DOWNLOAD_URL%" > "%INSTALL_DIR%\ffmpeg.zip" || ( echo. && echo ffmpeg failed to download. && goto end )
72
+ call powershell -command "Expand-Archive -Force '%INSTALL_DIR%\ffmpeg.zip' '%INSTALL_DIR%\'"
73
+ cd "%INSTALL_DIR%"
74
+ move ffmpeg-* ffmpeg
75
+ setx PATH "%INSTALL_FFMPEG_DIR%\bin\;%PATH%"
76
+ echo To use videos, you need to restart roop after this installation.
77
+ cd ..
78
+ )
79
+ ) else (
80
+ echo Skipping FFmpeg installation as it is already available.
81
+ )
82
+
83
+ @rem setup installer env
84
+ @rem check if conda environment was actually created
85
+ if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo ERROR: Conda environment is empty. && goto end )
86
+ @rem activate installer env
87
+ call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo ERROR: Miniconda hook not found. && goto end )
88
+ echo Launching roop unleashed
89
+ call python installer.py %COMMANDLINE_ARGS%
90
+
91
+ echo.
92
+ echo Done!
93
+
94
+ :end
95
+ pause