#!/bin/bash # Create a directory for the AI service logs mkdir -p logs # Activate virtual environment source venv/bin/activate # Export environment variables export API_HOST=0.0.0.0 export API_PORT=5252 # Make sure the Python path includes the current directory export PYTHONPATH=$PYTHONPATH:$(pwd) # Run the application with uvicorn and nohup nohup uvicorn ai_service.api:app --host $API_HOST --port $API_PORT > logs/ai_service.log 2>&1 & echo "AI Service started on port $API_PORT. Check ai_service.log for output." echo "To stop the application, find the process ID with 'ps aux | grep uvicorn' and kill it with 'kill '."