Python FastAPI Service
📁 rl-inference-service/
Core Application
🐍 app/main.py
- FastAPI application
- Loads trained PPO models
- POST
/predict_actionendpoint - GET
/healthand/model_infoendpoints - Error handling and logging
Configuration
📄 requirements.txt - Python dependencies
fastapi==0.110.0
uvicorn==0.28.0
stable-baselines3==2.2.1
torch==2.2.1
numpy==1.26.4
pydantic==2.6.4
python-dotenv==1.0.1
shimmy==0.2.1
jinja2==3.1.3
aiofiles==24.1.0
Deployment
📄 Dockerfile
- Python 3.9-slim container
- Builds dependencies
- Exposes port 8000
- Runs with uvicorn
Configuration Templates
📄 .env.example
- Environment variable template
Data Directory
📁 app/models/
- Directory for trained models
- (Models copied here by select_model.py)
-
model.zip- Trained PPO model