Files
OCR/run_backend.sh

26 lines
747 B
Bash
Executable File

#!/bin/bash
# Navigate to the backend directory
cd "$(dirname "$0")/backend" || exit
# Activate the virtual environment
if [ ! -d "venv" ]; then
echo "Creating virtual environment 'venv'..."
python3 -m venv venv
fi
echo "Activating virtual environment..."
source venv/bin/activate
# Auto-install dependencies if crucial modules are missing
if ! python -c "import uvicorn, numpy, cv2, pdf2image" &>/dev/null; then
echo "Dependencies missing. Installing python dependencies..."
pip install --upgrade pip --quiet
pip install -r requirements.txt
echo "Dependencies installed ✓"
fi
# Run the FastAPI server
echo "Starting OCR Backend Server on http://0.0.0.0:8000..."
uvicorn main:app --reload --host 0.0.0.0 --port 8000