Spaces:
Running on Zero
Running on Zero
Download start_mac_linux.sh from Mohammed-Abdullah/Driving-risk-estimation: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/Mohammed-Abdullah/Driving-risk-estimation/resolve/main/start_mac_linux.sh
- Command line
-
hf download hf://spaces/Mohammed-Abdullah/Driving-risk-estimation/start_mac_linux.sh
-
curl -L -o start_mac_linux.sh https://huggingface.co/spaces/Mohammed-Abdullah/Driving-risk-estimation/resolve/main/start_mac_linux.sh
1.15 kB
| # One-click start on macOS / Linux: the first run installs everything (10-20 min), later runs start in seconds. | |
| # bash start_mac_linux.sh | |
| set -e | |
| cd "$(dirname "$0")" | |
| if ! { [ -x venv/bin/python ] && venv/bin/python -c "import gradio, torch, transformers, timm" >/dev/null 2>&1; }; then | |
| PY="" | |
| for c in python3.11 python3 python; do | |
| if command -v "$c" >/dev/null 2>&1 && "$c" -c 'import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)'; then PY="$c"; break; fi | |
| done | |
| if [ -z "$PY" ]; then echo "Python 3.10 or newer was not found. Install Python 3.11 from https://www.python.org/downloads/ and run this again."; exit 1; fi | |
| echo "First run: setting up. This downloads about 3 GB and takes 10-20 minutes." | |
| [ -x venv/bin/python ] || "$PY" -m venv venv | |
| venv/bin/python -m pip install --upgrade pip | |
| # On Linux the standard PyTorch package already includes NVIDIA GPU support; on a Mac the app runs on the processor. | |
| venv/bin/python -m pip install -r requirements.txt gradio==6.31.0 | |
| fi | |
| echo "Starting the app. Your browser opens when it is ready. Press Ctrl+C to stop." | |
| exec venv/bin/python app.py --open "$@" | |