#!/bin/bash # Start Nginx service service nginx start # Check if Nginx started successfully if [ $? -ne 0 ]; then echo "Failed to start Nginx. Logging error log:" cat /var/log/nginx/error.log exit 1 fi # Start Gunicorn for the Flask app gunicorn --bind 0.0.0.0:8080 api_app:app & # Start Gunicorn for the Gradio frontend python spaces_app.py & # Wait for all background processes to finish wait