A complete machine learning model deployment using FastAPI and Streamlit with Docker.
ml-deployment-project/
├── models/ # Saved ML models
├── code/
│ ├── models/ # Model training code
│ └── deployment/ # Deployment configuration
│ ├── api/ # FastAPI service
│ ├── app/ # Streamlit app
│ └── docker-compose.yml
├── data/ # Data files
└── requirements.txt # Python dependencies
- Train the model:
cd code/models
python train_model.py- Deploy with Docker:
cd code/deployment
docker-compose up --build-
Access the applications:
- Streamlit App: http://localhost:8501
- FastAPI API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Port: 8000
- Endpoints:
GET /- Service statusGET /health- Health checkPOST /predict- Make predictionsGET /model-info- Model information
- Port: 8501
- Features: Interactive web interface for model predictions
# Install dependencies
pip install -r requirements.txt
# Train model
python code/models/train_model.py
# Run API locally
cd code/deployment/api
uvicorn main:app --reload
# Run app locally
cd code/deployment/app
streamlit run app.py