File size: 1,067 Bytes
e59dc66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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"