Skip to content

Makedonsky303/ML-FastAPI-Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ML FastAPI Docker

A simple ML model served as a REST API using FastAPI and Docker. The model predicts Titanic survival based on age, passenger class, and alone status.

Project structure

ml-fastapi-docker/
├── main.py
├── train.py
├── model.joblib
├── requirements.txt
├── Dockerfile
└── README.md

Run locally

Install dependencies: pip install -r requirements.txt

Run the app: uvicorn main:app --reload

Run with Docker

Build the image: docker build -t ml-fastapi-app .

Run the container: docker run -p 8000:8000 ml-fastapi-app

API Endpoints

GET / — returns {"message": "ML API is running"} POST /predict — returns survival prediction

Example input for /predict

{ "age": 25, "pclass": "First", "alone": 0 }

Example Output

{ "prediction": "survived" }

API Documentation

Open http://localhost:8000/docs in your browser to access the Swagger UI. (click POST/predict -> Try it out -> change the input -> Execute)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors