File size: 951 Bytes
27a24b2
 
 
 
 
9edf83b
 
27a24b2
 
ed78072
 
 
 
 
 
 
 
 
 
 
 
27a24b2
 
 
 
 
 
 
 
 
9edf83b
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
#!/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 exist
echo "Setting up directories..."
mkdir -p data/users data/sessions data/conversations data/feedback
mkdir -p mental_health_model_artifacts/chroma_db

# Verify NLTK data exists and is accessible
echo "Checking NLTK data..."
if [ -d "/app/nltk_data" ]; then
    echo "NLTK data directory exists at /app/nltk_data"
    # List contents to verify
    ls -la /app/nltk_data
else
    echo "WARNING: NLTK data directory not found at /app/nltk_data"
    # Create the directory anyway
    mkdir -p /app/nltk_data
fi

# 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