Block 147: Capstone: API or Interface (Optional)
Expose your project as an API or simple web interface.
Concepts
- FastAPI endpoint for model predictions
- Flask data dashboard with live queries
- Streamlit for quick data apps (optional)
- Input validation and error handling at the interface layer
Code Examples
See exercise below.
Exercise
If ML project: wrap your best model as a FastAPI /predict endpoint with Pydantic validation. If data project: add a Flask /summary route that returns key stats as JSON. Test every endpoint with both valid and invalid inputs.
Homework
What additional features would make your API or interface production-ready? List 5.