Add python webui & Add simple run shell script

This commit is contained in:
wsl-wy
2023-08-05 20:48:26 +08:00
parent a30bad0ae6
commit df25dee167
2 changed files with 154 additions and 0 deletions

45
run_web_demo.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
thisDir=$(pwd)
function performInstall() {
set -e
pushd "$thisDir"
pip3 install -r requirements.txt
pip3 install gradio mdtex2html scipy
if [[ ! -d flash-attention ]]; then
if ! git clone -b v1.0.8 https://github.com/Dao-AILab/flash-attention; then
echo "Clone flash-attention failed, please install it manually."
return 0
fi
fi
cd flash-attention &&
pip3 install . &&
pip3 install csrc/layer_norm &&
pip3 install csrc/rotary ||
echo "Install flash-attention failed, please install it manually."
popd
}
echo "Starting WebUI..."
if ! python3 web_demo.py; then
echo "Run demo failed, install the deps and try again? (y/n)"
# auto perform install if in docker
if [[ -t 0 ]] && [[ -t 1 ]] && [[ ! -f "/.dockerenv" ]]; then
read doInstall
else
doInstall="y"
fi
if ! [[ "$doInstall" =~ y|Y ]]; then
exit 1
fi
echo "Installing deps, and try again..."
performInstall && python3 web_demo.py
fi