#!/bin/bash # This script handles startup for the API on Hugging Face Spaces echo "===== Application Startup at $(date -u '+%Y-%m-%d %H:%M:%S') =====" # Make sure our custom directories are properly readable/writable echo "Setting up directories with proper permissions..." mkdir -p data/users data/sessions data/conversations data/feedback mkdir -p mental_health_model_artifacts/chroma_db mkdir -p nltk_data chmod -R 777 data nltk_data mental_health_model_artifacts # Create .env file if it doesn't exist if [ ! -f .env ]; then echo "Creating .env file from .env.example..." cp .env.example .env fi # Start the API with uvicorn echo "Starting API server..." exec uvicorn app:app --host 0.0.0.0 --port 7860