Skip to content

added command line options to start-webui.sh for changing root url to subfolder #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
26eeb2f
u
tknr Sep 8, 2024
63ef235
u
tknr Sep 8, 2024
89b19c9
added models
tknr Sep 12, 2024
37bb63e
Merge branch 'rupeshs:main' into main
tknr Sep 15, 2024
1040a6f
added options treatments to start-webui.sh
tknr Sep 14, 2024
854fae9
Correct version
rupeshs Sep 14, 2024
9f33f11
Merge pull request #1 from tknr/feature/1
tknr Sep 15, 2024
b36e37e
added options treatments to start-webui.sh
tknr Sep 14, 2024
b6dd981
Merge branch 'main' into feature/1
tknr Sep 15, 2024
c8e7bf7
Merge pull request #2 from tknr/feature/1
tknr Sep 15, 2024
007f637
added options treatments to start-webui.sh
tknr Sep 15, 2024
459874a
Merge pull request #3 from tknr/feature/1
tknr Sep 15, 2024
091b7d3
cli shell
tknr Sep 18, 2024
97a2f7e
Merge pull request #4 from tknr/feature/1
tknr Sep 18, 2024
12fda77
Merge branch 'rupeshs:main' into main
tknr Oct 6, 2024
76fa5d0
Merge branch 'rupeshs:main' into main
tknr Oct 29, 2024
a1eabca
Merge branch 'rupeshs:main' into main
tknr Nov 6, 2024
0a29677
Merge branch 'rupeshs:main' into main
tknr Dec 18, 2024
3ae6ed2
Merge branch 'rupeshs:main' into main
tknr Mar 5, 2025
5745e94
Merge branch 'rupeshs:main' into main
tknr Mar 28, 2025
5d8920e
u
tknr Oct 6, 2024
9b93620
u
tknr Oct 6, 2024
93fa8f7
u
tknr Oct 6, 2024
00135a3
u
tknr Mar 28, 2025
900e899
Merge pull request #5 from tknr/feature/1
tknr Apr 26, 2025
e53c63c
Merge branch 'main' into main
tknr Apr 26, 2025
d51476d
Merge branch 'rupeshs:main' into main
tknr May 7, 2025
1c06dcd
u
tknr May 7, 2025
6c6b960
Merge pull request #6 from tknr/feature/1
tknr May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ __pycache__
results
# excluding user settings for the GUI frontend
configs/settings.yaml
controlnet_models/*.safetensors
lora_models/*.safetensors

libstable-diffusion.so
models/gguf/
10 changes: 7 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,12 @@ To install FastSD CPU on Windows run the following steps :

`./start-webui.sh`

##### webui options

- to use share option : `./start-webui.sh --share`
- to change root url : example. `./start-webui.sh --root_url "/fastsdcpu"`
- show help : `./start-webui.sh --help`

### FastSD CPU on Mac

![FastSD CPU running on Mac](https://raw.githubusercontent.com/rupeshs/fastsdcpu/main/docs/images/fastsdcpu-mac-gui.jpg)
Expand Down Expand Up @@ -489,9 +495,7 @@ Due to the limitation of using CPU/OpenVINO inside colab, we are using GPU with

##### Linux users

`source env/bin/activate`

Start CLI `src/app.py -h`
Start CLI `bash fastsdcpu_cli.sh -h`

<a id="android"></a>

Expand Down
4 changes: 3 additions & 1 deletion configs/openvino-lcm-models.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ rupeshs/sdxl-turbo-openvino-int8
rupeshs/LCM-dreamshaper-v7-openvino
Disty0/LCM_SoteMix
rupeshs/FLUX.1-schnell-openvino-int4
rupeshs/sd15-lcm-square-openvino-int8
rupeshs/sd15-lcm-square-openvino-int8
rupeshs/taesdxl-openvino

26 changes: 26 additions & 0 deletions fastsdcpu_cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
cd $(dirname $0)
echo Starting FastSD CPU please wait...
set -e
PYTHON_COMMAND="python3"

if ! command -v python3 &>/dev/null; then
if ! command -v python &>/dev/null; then
echo "Error: Python not found, please install python 3.8 or higher and try again"
exit 1
fi
fi

if command -v python &>/dev/null; then
PYTHON_COMMAND="python"
fi

echo "Found $PYTHON_COMMAND command"

python_version=$($PYTHON_COMMAND --version 2>&1 | awk '{print $2}')
echo "Python version : $python_version"

BASEDIR=$(pwd)
# shellcheck disable=SC1091
source "$BASEDIR/env/bin/activate"
$PYTHON_COMMAND src/app.py $@
Empty file modified install-mac.sh
100644 → 100755
Empty file.
6 changes: 5 additions & 1 deletion install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
cd $(dirname $0)
echo Starting FastSD CPU env installation...
set -e
PYTHON_COMMAND="python3"
Expand Down Expand Up @@ -39,6 +40,9 @@ else
uv pip install -r "$BASEDIR/requirements.txt"
fi

## https://github.com/jhj0517/Whisper-WebUI/issues/258#issuecomment-2333390291
#pip install -U gradio

chmod +x "start.sh"
chmod +x "start-webui.sh"
read -n1 -r -p "FastSD CPU installation completed,press any key to continue..." key
read -n1 -r -p "FastSD CPU installation completed,press any key to continue..." key
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ onnxruntime==1.17.3
pydantic
typing-extensions==4.8.0
pyyaml==6.0.1
gradio==5.6.0
gradio
peft==0.6.1
opencv-python==4.8.1.78
omegaconf==2.3.0
Expand Down
11 changes: 11 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
from paths import FastStableDiffusionPaths, ensure_path
from state import get_context, get_settings
from utils import show_system_info
from backend.device import get_device_name
from transformers.utils.hub import move_cache

move_cache()

parser = ArgumentParser(description=f"FAST SD CPU {constants.APP_VERSION}")
parser.add_argument(
Expand Down Expand Up @@ -258,6 +262,12 @@
help="Web server port",
default=8000,
)
parser.add_argument(
"--root_path",
type=str,
help="Web server root path",
default=None,
)

args = parser.parse_args()

Expand Down Expand Up @@ -316,6 +326,7 @@
print("Starting web UI mode")
start_webui(
args.share,
args.root_path,
)
elif args.realtime:
from frontend.webui.realtime_ui import start_realtime_text_to_image
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/webui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def change_mode(mode):

def start_webui(
share: bool = False,
root_path: str = "/",
):
webui = get_web_ui()
webui.queue()
webui.launch(share=share)
webui.launch(share=share,root_path=root_path)
3 changes: 2 additions & 1 deletion start-webserver.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
cd $(dirname $0)
echo Starting FastSD CPU please wait...
set -e
PYTHON_COMMAND="python3"
Expand All @@ -22,4 +23,4 @@ echo "Python version : $python_version"
BASEDIR=$(pwd)
# shellcheck disable=SC1091
source "$BASEDIR/env/bin/activate"
$PYTHON_COMMAND src/app.py --api
$PYTHON_COMMAND src/app.py --api
23 changes: 22 additions & 1 deletion start-webui.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
cd $(dirname $0)
echo Starting FastSD CPU please wait...
set -e
PYTHON_COMMAND="python3"
Expand All @@ -22,4 +23,24 @@ echo "Python version : $python_version"
BASEDIR=$(pwd)
# shellcheck disable=SC1091
source "$BASEDIR/env/bin/activate"
$PYTHON_COMMAND src/app.py -w

## https://qiita.com/ko1nksm/items/7d37852b9fc581b1266e
abort() { echo "$*" >&2; exit 1; }
unknown() { abort "unrecognized option '$1'"; }
required() { [ $# -gt 1 ] || abort "option '$1' requires an argument"; }

OPTION_SHARE=''
OPTION_ROOT_PATH=''

while [ $# -gt 0 ]; do
case $1 in
-s | --share ) OPTION_SHARE=' --share' ;;
-r | --root_path ) required "$@" && shift; OPTION_ROOT_PATH=' --root_path='$1 ;;
-h | --help ) abort "usage : $(basename $0) [--share] [--root_path=\"/(path)\"]" ;;
-?*) unknown "$@" ;;
*) break
esac
shift
done

$PYTHON_COMMAND $BASEDIR/src/app.py -w ${OPTION_SHARE} ${OPTION_ROOT_PATH}
3 changes: 2 additions & 1 deletion start.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
cd $(dirname $0)
echo Starting FastSD CPU please wait...
set -e
PYTHON_COMMAND="python3"
Expand All @@ -22,4 +23,4 @@ echo "Python version : $python_version"
BASEDIR=$(pwd)
# shellcheck disable=SC1091
source "$BASEDIR/env/bin/activate"
$PYTHON_COMMAND src/app.py --gui
$PYTHON_COMMAND src/app.py --gui