File size: 1,089 Bytes
8b7e8f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# Hugging Face Spaces startup script for Lega.AI

echo "🚀 Starting Lega.AI on Hugging Face Spaces..."

# Create necessary directories if they don't exist
mkdir -p data/chroma_db
mkdir -p uploads
mkdir -p .streamlit

# Set default environment variables for Hugging Face deployment
export STREAMLIT_SERVER_PORT=${PORT:-7860}
export STREAMLIT_SERVER_ADDRESS="0.0.0.0"
export DEBUG=False
export LOG_LEVEL=INFO
export STREAMLIT_CONFIG_DIR=/app/.streamlit
export XDG_CONFIG_HOME=/app

# Check if GOOGLE_API_KEY is set
if [ -z "$GOOGLE_API_KEY" ]; then
    echo "⚠️  WARNING: GOOGLE_API_KEY environment variable is not set!"
    echo "Please set it in your Hugging Face Space settings for the app to work properly."
fi

# Start the Streamlit application
echo "🌐 Starting Streamlit on port $STREAMLIT_SERVER_PORT..."
exec streamlit run main.py \
    --server.port=$STREAMLIT_SERVER_PORT \
    --server.address=$STREAMLIT_SERVER_ADDRESS \
    --server.headless=true \
    --server.fileWatcherType=none \
    --server.enableCORS=false \
    --server.enableXsrfProtection=false