Thelocallab commited on
Commit
2075303
·
verified ·
1 Parent(s): 58c4fe5

Upload 2 files

Browse files
Files changed (2) hide show
  1. webui-update.sh +97 -0
  2. webui-user-update.sh +14 -0
webui-update.sh ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Load settings if present
4
+ if [[ -f webui.settings.sh ]]; then
5
+ source webui.settings.sh
6
+ fi
7
+
8
+ : "${PYTHON:=python3}"
9
+ if [[ -n "$GIT" ]]; then
10
+ export GIT_PYTHON_GIT_EXECUTABLE="$GIT"
11
+ fi
12
+ : "${VENV_DIR:=$(pwd)/venv}"
13
+
14
+ export SD_WEBUI_RESTART=tmp/restart
15
+ export ERROR_REPORTING=FALSE
16
+
17
+ mkdir -p tmp
18
+
19
+ uv help python >tmp/stdout.txt 2>tmp/stderr.txt
20
+ if [[ $? -eq 0 ]]; then
21
+ goto_check_pip=true
22
+ else
23
+ $PYTHON -c "" >tmp/stdout.txt 2>tmp/stderr.txt
24
+ if [[ $? -eq 0 ]]; then
25
+ goto_check_pip=true
26
+ else
27
+ echo "Couldn't launch python"
28
+ goto_show_stdout_stderr=true
29
+ fi
30
+ fi
31
+
32
+ if [[ $goto_check_pip == true ]]; then
33
+ uv help pip >tmp/stdout.txt 2>tmp/stderr.txt
34
+ if [[ $? -eq 0 ]]; then
35
+ goto_start_venv=true
36
+ else
37
+ $PYTHON -m pip --help >tmp/stdout.txt 2>tmp/stderr.txt
38
+ if [[ $? -eq 0 ]]; then
39
+ goto_start_venv=true
40
+ else
41
+ echo "Couldn't launch pip"
42
+ goto_show_stdout_stderr=true
43
+ fi
44
+ fi
45
+ fi
46
+
47
+ if [[ $goto_start_venv == true ]]; then
48
+ if [[ "$VENV_DIR" != "-" && "$SKIP_VENV" != "1" ]]; then
49
+ if [[ -f "$VENV_DIR/bin/python" ]]; then
50
+ PYTHON="$VENV_DIR/bin/python"
51
+ source "$VENV_DIR/bin/activate"
52
+ echo "venv $PYTHON"
53
+ else
54
+ PYTHON_FULLNAME=$(python3 -c "import sys; print(sys.executable)")
55
+ echo "Creating venv in directory $VENV_DIR using python $PYTHON_FULLNAME"
56
+ $PYTHON_FULLNAME -m venv "$VENV_DIR" >tmp/stdout.txt 2>tmp/stderr.txt
57
+ if [[ $? -eq 0 ]]; then
58
+ "$VENV_DIR/bin/python" -m pip install --upgrade pip
59
+ PYTHON="$VENV_DIR/bin/python"
60
+ source "$VENV_DIR/bin/activate"
61
+ echo "venv $PYTHON"
62
+ else
63
+ echo "Unable to create venv in directory $VENV_DIR"
64
+ goto_show_stdout_stderr=true
65
+ fi
66
+ fi
67
+ fi
68
+ fi
69
+
70
+ # Launch application
71
+ if [[ $goto_show_stdout_stderr == true ]]; then
72
+ echo
73
+ echo "exit code: $?"
74
+ if [[ -s tmp/stdout.txt ]]; then
75
+ echo
76
+ echo "stdout:"
77
+ cat tmp/stdout.txt
78
+ fi
79
+ if [[ -s tmp/stderr.txt ]]; then
80
+ echo
81
+ echo "stderr:"
82
+ cat tmp/stderr.txt
83
+ fi
84
+ echo
85
+ echo "Launch Unsuccessful! Exiting..."
86
+ read -n 1 -s -r -p "Press any key to continue..."
87
+ exit 1
88
+ fi
89
+
90
+ "$PYTHON" launch.py "$@"
91
+ if [[ -f tmp/restart ]]; then
92
+ # If restart file exists, rerun venv logic
93
+ exec "$0" "$@"
94
+ fi
95
+
96
+ read -n 1 -s -r -p "Press any key to continue..."
97
+ exit
webui-user-update.sh ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Uncomment and set if desired
4
+ # export PYTHON=
5
+ # export GIT=
6
+ # export VENV_DIR=
7
+
8
+ export COMMANDLINE_ARGS=""
9
+
10
+ # --xformers --sage --uv
11
+ # --pin-shared-memory --cuda-malloc --cuda-stream
12
+ # --skip-python-version-check --skip-torch-cuda-test --skip-version-check --skip-prepare-environment --skip-install
13
+
14
+ bash webui.sh