#!/bin/bash # Server deployment script for Image Description Application echo "Starting Image Description API server deployment" # Create virtual environment if it doesn't exist if [ ! -d "venv" ]; then echo "Creating virtual environment..." python3 -m venv venv fi # Activate virtual environment echo "Activating virtual environment..." source venv/bin/activate # Install requirements echo "Installing dependencies..." pip install -r image_descriptor_requirements.txt # Create necessary directories echo "Setting up directories..." mkdir -p uploads mkdir -p logs # Start the server with Gunicorn echo "Starting server with Gunicorn..." gunicorn --bind 0.0.0.0:8000 --workers 1 --timeout 300 "image_descriptor:app" \ --log-level info \ --access-logfile logs/access.log \ --error-logfile logs/error.log \ --daemon echo "Server started in the background on port 8000" echo "You can test it with: curl http://localhost:8000/health" echo "To process an image: curl -X POST -F \"image=@data_temp/page_2.png\" http://localhost:8000/describe"