Spaces:
Paused
Paused
Download chatkit/run-local.sh from taboola-cz/ClassLens-dev: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/spaces/taboola-cz/ClassLens-dev/resolve/main/chatkit/run-local.sh
- Command line
-
hf download hf://spaces/taboola-cz/ClassLens-dev/chatkit/run-local.sh
-
curl -L -o run-local.sh https://huggingface.co/spaces/taboola-cz/ClassLens-dev/resolve/main/chatkit/run-local.sh
1.97 kB
| # Run ClassLens locally (both backend and frontend) | |
| set -e | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| cd "$SCRIPT_DIR" | |
| echo "๐ Starting ClassLens locally..." | |
| echo "" | |
| # Check for .env file (project root or chatkit/) โ resolve to absolute path | |
| if [ -f "$SCRIPT_DIR/../.env" ]; then | |
| ENV_FILE="$SCRIPT_DIR/../.env" | |
| elif [ -f "$SCRIPT_DIR/.env" ]; then | |
| ENV_FILE="$SCRIPT_DIR/.env" | |
| else | |
| echo "โ ๏ธ No .env file found. Please create one from env.example" | |
| exit 1 | |
| fi | |
| echo "๐ Using env file: $ENV_FILE" | |
| # Function to cleanup on exit | |
| cleanup() { | |
| echo "" | |
| echo "๐ Stopping servers..." | |
| pkill -f "uvicorn app.main" 2>/dev/null || true | |
| pkill -f "vite" 2>/dev/null || true | |
| exit 0 | |
| } | |
| trap cleanup SIGINT SIGTERM | |
| # Start backend | |
| echo "๐ฆ Starting backend on http://127.0.0.1:8000" | |
| cd backend | |
| if [ ! -d ".venv" ]; then | |
| echo "Creating Python virtual environment..." | |
| python3 -m venv .venv | |
| fi | |
| source .venv/bin/activate | |
| pip install -q -e . > /dev/null 2>&1 | |
| # Load environment variables | |
| set -a | |
| source "$ENV_FILE" | |
| set +a | |
| # Start backend in background | |
| uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload > /tmp/classlens-backend.log 2>&1 & | |
| BACKEND_PID=$! | |
| # Wait a bit for backend to start | |
| sleep 2 | |
| # Start frontend | |
| echo "๐จ Starting frontend on http://localhost:3003" | |
| cd ../frontend | |
| # Install frontend dependencies if needed | |
| if [ ! -d "node_modules" ]; then | |
| echo "Installing frontend dependencies..." | |
| npm install | |
| fi | |
| # Start frontend | |
| npm run dev > /tmp/classlens-frontend.log 2>&1 & | |
| FRONTEND_PID=$! | |
| echo "" | |
| echo "โ ClassLens is running!" | |
| echo "" | |
| echo " Backend: http://127.0.0.1:8000" | |
| echo " Frontend: http://localhost:3003" | |
| echo "" | |
| echo " Backend logs: tail -f /tmp/classlens-backend.log" | |
| echo " Frontend logs: tail -f /tmp/classlens-frontend.log" | |
| echo "" | |
| echo "Press Ctrl+C to stop both servers" | |
| echo "" | |
| # Wait for both processes | |
| wait $BACKEND_PID $FRONTEND_PID | |