jhj0517
commited on
Commit
•
79580b2
1
Parent(s):
d7bbc82
Add shell script
Browse files- install.ps1 +23 -0
- start-webui.ps1 +11 -0
- update.ps1 +14 -0
install.ps1
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
if (-Not (Test-Path -Path "$PSScriptRoot\venv\Scripts")) {
|
2 |
+
Write-Output "Creating venv..."
|
3 |
+
python -m venv venv
|
4 |
+
}
|
5 |
+
|
6 |
+
Write-Output "Checked the venv folder. Now installing requirements..."
|
7 |
+
|
8 |
+
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
|
9 |
+
|
10 |
+
& "$PSScriptRoot\venv\Scripts\Activate.ps1"
|
11 |
+
|
12 |
+
python -m pip install -U pip
|
13 |
+
pip install -r requirements.txt
|
14 |
+
|
15 |
+
if ($LASTEXITCODE -ne 0) {
|
16 |
+
Write-Output ""
|
17 |
+
Write-Output "Requirements installation failed. Please remove the venv folder and run the script again."
|
18 |
+
} else {
|
19 |
+
Write-Output ""
|
20 |
+
Write-Output "Requirements installed successfully."
|
21 |
+
}
|
22 |
+
|
23 |
+
Read-Host -Prompt "Press Enter to continue..."
|
start-webui.ps1
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
if (-Not (Test-Path -Path "$PSScriptRoot\venv\Scripts")) {
|
2 |
+
Write-Output "Creating venv..."
|
3 |
+
& .\install.ps1
|
4 |
+
}
|
5 |
+
|
6 |
+
& .\venv\Scripts\Activate.ps1
|
7 |
+
|
8 |
+
python .\app.py $args
|
9 |
+
|
10 |
+
Write-Host "Launching the app"
|
11 |
+
Pause
|
update.ps1
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
try {
|
2 |
+
git pull origin master 2>$null
|
3 |
+
if ($LASTEXITCODE -eq 0) {
|
4 |
+
Write-Output "Successfully updated WebUI."
|
5 |
+
} else {
|
6 |
+
throw
|
7 |
+
}
|
8 |
+
} catch {
|
9 |
+
git reset --hard
|
10 |
+
git pull origin master
|
11 |
+
Write-Output "Successfully updated WebUI."
|
12 |
+
}
|
13 |
+
|
14 |
+
pause
|