A simple ML project for classifying fox (and cat just) using PyTorch, FastAPI, and Streamlit.
The application runs via Docker Compose and consists of two services:
- API (FastAPI + Uvicorn) β performs predictions using the trained model.
- UI (Streamlit) β provides a user-friendly web interface to upload images and get results.
project-root/
βββ foxes_for_TA # A folder with Fox images for network testing, try them all, I searched very diligently for them :)
βββ code/
β βββ models/ # model training
β βββ deployment/
β β βββ api/ # FastAPI service and best model storage
β β βββ app/ # Streamlit service
βββ docker-compose.yml # runs both services
βββ README.md
docker compose up --buildAfter that the following services will be available:
- API: http://localhost:8000/docs (Swagger UI)
- Streamlit UI: http://localhost:8501
- Open http://localhost:8501.
- Upload an image (cat / fox).
- Get a prediction from the model.
You can send a request directly:
curl -X POST "http://localhost:8000/predict/" \
-F "file=@fox.jpg"Response:
{
"class": "fox
}- Python 3.10
- PyTorch + Torchvision
- FastAPI
- Streamlit
- Docker & Docker Compose
In root of repo run following command
python code/models/thinker_main.py - Add model training inside a container
- Store prediction history
- Extend dataset and classes