NegiTurkey commited on
Commit
31ecee9
1 Parent(s): abf8cc6

Upload Multi_Birefnet_for_Background_Removal.bat

Browse files
Multi_Birefnet_for_Background_Removal.bat ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ pushd %~dp0
3
+
4
+ set BIREFNET_PORT=7860
5
+ set HOME=%USERPROFILE%
6
+ set CUDA_VERSION=
7
+
8
+ :: Check if CUDA 12.1 is installed
9
+ python -c "import torch; print(torch.version.cuda)" 2>nul | findstr /C:"12.1" >nul
10
+ if %errorlevel% == 0 (
11
+ set CUDA_VERSION=12.1
12
+ ) else (
13
+ set CUDA_VERSION=none
14
+ )
15
+
16
+ if not exist MBBR_venv\ (
17
+ python -m venv MBBR_venv
18
+ call MBBR_venv\Scripts\activate
19
+ python -m pip install --upgrade pip
20
+ REM pip install Multi_Birefnet_for_Background_Removal
21
+ git clone https://huggingface.co/spaces/NegiTurkey/Multi_Birefnetfor_Background_Removal temp
22
+ REM Move all files and folders from temp to the parent directory
23
+ xcopy temp\* .\
24
+ REM Remove the now-empty temp directory
25
+ rmdir /s /q temp
26
+ if "%CUDA_VERSION%"=="12.1" (
27
+ pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu121
28
+ powershell -Command "(Get-Content app.py) -replace 'to\(\"cpu\"\)', 'to(\"cuda\")' | Set-Content app.py"
29
+ ) else (
30
+ pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cpu
31
+ )
32
+ pip install -r requirements.txt
33
+ )
34
+
35
+ call MBBR_venv\Scripts\activate
36
+ start http://localhost:%BIREFNET_PORT%/
37
+ echo http://localhost:%BIREFNET_PORT%/
38
+
39
+ python -m app --port %BIREFNET_PORT%
40
+ REM python -m app --port %BIREFNET_PORT%
41
+
42
+ popd
43
+
44
+