2.1 KiB
2.1 KiB
Running the AI-Detection Project
This project is a FastAPI-based AI application for detection and RAG (Retrieval-Augmented Generation).
Prerequisites
- Python 3.11+ (for local setup)
- Docker and Docker Compose (for containerized setup - Recommended)
- PostgreSQL and Redis (if running locally)
🚀 Option 1: Running with Docker (Recommended)
The easiest way to run the project is using Docker Compose, which sets up the application, database, and Redis automatically.
-
Configure Environment Variables: Copy the example environment file and fill in your keys:
cp .env.example .envNote: Open
.envand provide yourOPENAI_API_KEYorANTHROPIC_API_KEYif using AI features. -
Start the Services:
docker-compose up --build -
Access the API:
- API Documentation (Swagger UI): http://localhost:8000/docs
- Health Check: http://localhost:8000/health
🛠️ Option 2: Running Locally
If you prefer to run the application directly on your machine:
-
Create a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install Dependencies:
pip install -r requirements.txt -
Configure Environment Variables: Copy
.env.exampleto.envand update the settings:- Set
DATABASE_URLto point to your local PostgreSQL instance (e.g.,postgresql://user:pass@localhost:5432/dbname). - Set
REDIS_HOSTtolocalhost.
- Set
-
Run the Application:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
📂 Project Structure Highlights
main.py: Entry point of the FastAPI application.src/config/: Configuration management and startup migrations.src/services/: Core business logic (RAG, JWT, etc.).src/migrations/: Database schema definitions.docker-compose.yml: Multi-container orchestration.
🧪 Testing
To run tests, ensure dependencies are installed and run:
pytest