Get up and running in 5 minutes!
# 1. Build and run
docker-compose up -d
# 2. Check health
curl http://localhost:8000/api/v1/health
# 3. Test prediction
curl -X POST "http://localhost:8000/api/v1/predict/forecast" \
-H "Content-Type: application/json" \
-d '{"periods": 7, "freq": "D"}'
# 4. View docs
open http://localhost:8000/docs# 1. Setup (Windows)
scripts\setup.bat
# Setup (Linux/Mac)
chmod +x scripts/setup.sh
./scripts/setup.sh
# 2. Run
python run.py
# 3. Test
curl http://localhost:8000/api/v1/healthCreate app/models/mymodel.py:
from app.models.base import BaseMLModel
class MymodelModel(BaseMLModel):
def __init__(self):
super().__init__(model_name="mymodel", version="1.0")
async def load_model(self):
# Load your model here
# self.model = joblib.load("model_storage/mymodel.pkl")
self.is_loaded = True
async def predict(self, input_data):
# Your prediction logic
return {
"prediction": "result",
"model": self.model_name,
"version": self.version
}Edit .env:
MODEL_REGISTRY={"forecast": "forecast.py", "classifier": "classifier.py", "mymodel": "mymodel.py"}# Restart
docker-compose restart
# Or if running locally
# Ctrl+C and python run.py
# Test
curl -X POST "http://localhost:8000/api/v1/predict/mymodel" \
-H "Content-Type: application/json" \
-d '{"your": "input"}'curl -X POST "http://localhost:8000/api/v1/predict/forecast" \
-H "Content-Type: application/json" \
-d '{
"periods": 30,
"freq": "D"
}'curl -X POST "http://localhost:8000/api/v1/predict/classifier" \
-H "Content-Type: application/json" \
-d '{
"features": [1.2, 3.4, 5.6, 7.8]
}'import requests
# Forecast
response = requests.post(
"http://localhost:8000/api/v1/predict/forecast",
json={"periods": 7, "freq": "D"}
)
print(response.json())
# Classifier
response = requests.post(
"http://localhost:8000/api/v1/predict/classifier",
json={"features": [1.0, 2.0, 3.0, 4.0]}
)
print(response.json())- ✅ API is running
- 📖 Read full README.md
- 🔧 Customize for your models
- 🚀 Deploy to production
# Change port in .env
PORT=8001
# Or in docker-compose.yml
ports:
- "8001:8000"- Check
.envfile exists - Verify
MODEL_REGISTRYformat - Check model file names match registry
- View logs:
docker-compose logs
# Reinstall dependencies
pip install -r requirements.txt
# Or rebuild Docker
docker-compose build --no-cache- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Health: http://localhost:8000/api/v1/health
- Models: http://localhost:8000/api/v1/models
Need more help? Check the full README.md