# Deployment Guide ## Hugging Face Spaces Configuration This application is configured to run on Hugging Face Spaces with the following setup: ### Key Configuration Files 1. **README.md**: Contains the Hugging Face Spaces metadata - `sdk: gradio` - Uses Gradio framework (required for HF Spaces) - `app_file: app.py` - Points to the main Flask application - `sdk_version: 5.0.1` - Gradio version 2. **app.py**: Flask application configured for deployment - Uses environment variable `PORT` for port configuration - Debug mode disabled for production - Runs on `0.0.0.0` to accept external connections 3. **requirements.txt**: Dependencies for the application - `flask==3.0.0` - Web framework - `requests==2.31.0` - HTTP client for API calls - `gradio==5.0.1` - Required for Hugging Face Spaces ### Deployment Process 1. **Push to Repository**: The application will automatically deploy when pushed to the Hugging Face Spaces repository 2. **Build Process**: Hugging Face Spaces will: - Install dependencies from `requirements.txt` - Run the Flask application specified in `app.py` - Make the application available at the Spaces URL ### Environment Variables - `PORT`: Automatically set by Hugging Face Spaces (defaults to 7860) ### API Integration The application connects to the external API: - **Endpoint**: `https://findEthics-Atlas.hf.space/chat` - **Method**: POST - **Payload**: `{"prompt": "user_message", "history": []}` ### Testing Before deployment, the application was tested for: - ✅ Health endpoint functionality - ✅ Main page loading - ✅ Chat API integration - ✅ Error handling - ✅ Responsive design - ✅ Complete user flow ### Monitoring The application includes: - Health check endpoint at `/health` - Error logging and handling - Request/response validation