Delete run.sh
Browse files
run.sh
DELETED
|
@@ -1,62 +0,0 @@
|
|
| 1 |
-
#!/bin/sh
|
| 2 |
-
|
| 3 |
-
if [ "$(uname)" = "Darwin" ]; then
|
| 4 |
-
# macOS specific env:
|
| 5 |
-
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
| 6 |
-
export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
|
| 7 |
-
elif [ "$(uname)" != "Linux" ]; then
|
| 8 |
-
echo "Unsupported operating system."
|
| 9 |
-
exit 1
|
| 10 |
-
fi
|
| 11 |
-
|
| 12 |
-
if [ -d ".venv" ]; then
|
| 13 |
-
echo "Activate venv..."
|
| 14 |
-
. .venv/bin/activate
|
| 15 |
-
else
|
| 16 |
-
echo "Create venv..."
|
| 17 |
-
requirements_file="requirements.txt"
|
| 18 |
-
|
| 19 |
-
# Check if Python 3.8 is installed
|
| 20 |
-
if ! command -v python3.8 >/dev/null 2>&1 || pyenv versions --bare | grep -q "3.8"; then
|
| 21 |
-
echo "Python 3 not found. Attempting to install 3.8..."
|
| 22 |
-
if [ "$(uname)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then
|
| 23 |
-
brew install [email protected]
|
| 24 |
-
elif [ "$(uname)" = "Linux" ] && command -v apt-get >/dev/null 2>&1; then
|
| 25 |
-
sudo apt-get update
|
| 26 |
-
sudo apt-get install python3.8
|
| 27 |
-
else
|
| 28 |
-
echo "Please install Python 3.8 manually."
|
| 29 |
-
exit 1
|
| 30 |
-
fi
|
| 31 |
-
fi
|
| 32 |
-
|
| 33 |
-
python3.8 -m venv .venv
|
| 34 |
-
. .venv/bin/activate
|
| 35 |
-
|
| 36 |
-
# Check if required packages are installed and install them if not
|
| 37 |
-
if [ -f "${requirements_file}" ]; then
|
| 38 |
-
installed_packages=$(python3.8 -m pip freeze)
|
| 39 |
-
while IFS= read -r package; do
|
| 40 |
-
expr "${package}" : "^#.*" > /dev/null && continue
|
| 41 |
-
package_name=$(echo "${package}" | sed 's/[<>=!].*//')
|
| 42 |
-
if ! echo "${installed_packages}" | grep -q "${package_name}"; then
|
| 43 |
-
echo "${package_name} not found. Attempting to install..."
|
| 44 |
-
python3.8 -m pip install --upgrade "${package}"
|
| 45 |
-
fi
|
| 46 |
-
done < "${requirements_file}"
|
| 47 |
-
else
|
| 48 |
-
echo "${requirements_file} not found. Please ensure the requirements file with required packages exists."
|
| 49 |
-
exit 1
|
| 50 |
-
fi
|
| 51 |
-
fi
|
| 52 |
-
|
| 53 |
-
# Download models
|
| 54 |
-
chmod +x tools/dlmodels.sh
|
| 55 |
-
./tools/dlmodels.sh
|
| 56 |
-
|
| 57 |
-
if [ $? -ne 0 ]; then
|
| 58 |
-
exit 1
|
| 59 |
-
fi
|
| 60 |
-
|
| 61 |
-
# Run the main script
|
| 62 |
-
python3.8 infer-web.py --pycmd python3.8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|