Cerberus is a modular, containerized AI solution offering APIs for sentiment analysis, text summarization, and text generation. Built on top of fine-tuned and quantized Hugging Face models, Cerberus is designed for scalability, efficiency, and easy integration into workflows.
- Sentiment Analysis: Quickly classify text sentiment as positive, negative, or neutral.
- Summarization: Generate concise and meaningful summaries for long text.
- Text Generation: Produce creative or structured text based on input prompts.
- Scalable Architecture: Deployed using containerized services for easy scaling.
- Optimized Models: Uses fine-tuned and quantized Hugging Face models for speed and accuracy.
- OpenAPI Documentation: Built-in API documentation for developers.
- Extensible: Easily add new AI models and services.
- Programming Language: Python 3.10+
- Frameworks: FastAPI for API development
- AI Models: Hugging Face (Transformers, Optimum, Accelerate)
- Machine Learning Backend: PyTorch with MPS support for macOS (Apple Silicon)
- Data Handling: Datasets library by Hugging Face
- Deployment:
- Docker for containerization
- Docker Compose for service orchestration
-
Python 3.10 or higher
-
Poetry for dependency management:
curl -sSL https://install.python-poetry.org | python3 -
-
Docker and Docker Compose installed: Docker Installation Guide
-
Clone the Repository:
git clone https://github.com/BonnardValentin/cerberus cd cerberus
-
Install Dependencies with Poetry:
poetry install
-
Set Up Environment Variables: Create a
.env
file in the project root with the following:MODEL_PATH="./models/quantized" API_KEY="your-secret-key"
-
Start the Application: Using Docker Compose:
docker-compose up --build
-
Test the Application: Access the API at http://localhost:8000.
- Sentiment Analysis:
/analyze-sentiment/
- Summarization:
/summarize/
- Text Generation:
/generate-text/
Sentiment Analysis
curl -X POST http://localhost:8000/analyze-sentiment/ \
-H "Content-Type: application/json" \
-d '{"text": "I love Cerberus!"}'
Summarization
curl -X POST http://localhost:8000/summarize/ \
-H "Content-Type: application/json" \
-d '{"text": "Docker simplifies containerization by providing a platform to develop, ship, and run applications in isolated environments."}'
Text Generation
curl -X POST http://localhost:8000/generate-text/ \
-H "Content-Type: application/json" \
-d '{"text": "Once upon a time, in a faraway land,"}'
Cerberus provides an interactive OpenAPI UI:
- Visit http://localhost:8000/docs for Swagger UI.
- Visit http://localhost:8000/redoc for ReDoc.
-
Activate the Poetry environment:
poetry env activate
-
Start the FastAPI server:
uvicorn app.main:app --reload
Run a Python script to verify that models are loaded correctly:
from transformers import pipeline
model = pipeline("sentiment-analysis", model="./models/quantized")
print(model("I love open-source!"))
We welcome contributions to Cerberus! To contribute:
-
Fork the repository.
-
Create a feature branch:
git checkout -b feature-name
-
Commit your changes:
git commit -m "Add new feature"
-
Push to your fork:
git push origin feature-name
-
Open a pull request.
Please read our Contributing Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for details.