Skip to content

Starter template for your ML/AI projects (uv package manager, RestAPI with FastAPI and Dockerfile support)

License

Notifications You must be signed in to change notification settings

mlexpertio/ml-project-template

Repository files navigation

ML Project Template

Starter template for your Machine Learning/AI projects.

Features:

  • dvc for data versioning and pipeline management (reproducibility)
  • FastAPI for serving the model
  • uv package manager
  • ruff for linting and formatting
  • pytest for testing
  • loguru for logging
  • Docker for containerization

Install

Make sure you have uv installed.

Clone the repository:

git clone git@github.com:mlexpertio/ml-project-template.git .
cd ml-project-template

Install Python:

uv python install 3.12.8

Create and activate a virtual environment:

uv venv
source .venv/bin/activate

Install dependencies:

uv sync

Install package in editable mode:

uv pip install -e .

Install pre-commit hooks:

uv run pre-commit install

Reproduce

The project contains three different stages defined in dvc.yaml.

  • Create a dataset from the raw data:
uv run dvc repro build-dataset
  • Train a model using the dataset:
uv run dvc repro train-model
  • Evaluate the model using the test dataset:
uv run dvc repro evaluate

API server

Start the FastAPI server:

uv run python app.py

Test the API:

curl -X POST "http://localhost:8000/predict" \
     -H "Content-Type: application/json" \
     -d '{"text": "lets launch now"}'

Tests

uv run pytest

Docker

The template includes a Dockerfile to build a Docker image:

docker build -t prophet:latest .

Run the Docker container:

docker run -d -p 8000:8000 --name prophet prophet:latest

About

Starter template for your ML/AI projects (uv package manager, RestAPI with FastAPI and Dockerfile support)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published