Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

QUICK_START.md 2.0 KB

You have to be logged in to leave a comment. Sign In

MLflow Model Serving - Essential Commands

Quick Start (3 Commands)

# 1. Install dependencies
pip install -r requirements.txt

# 2. Train the model
python simple_train.py

# 3. Start the API
python app.py

API Available at: http://localhost:8000 Interactive Docs: http://localhost:8000/docs


Test Commands

# Test the API
python test_api.py

# Manual test with curl
curl -X POST "http://localhost:8000/predict" \
     -H "Content-Type: application/json" \
     -d '{"features": [5.1, 3.5, 1.4, 0.2]}'

Docker Commands

# Build image
docker build -t iris-model-api .

# Run container
docker run -p 8000:8000 iris-model-api

# Test Docker container
curl http://localhost:8000/predict \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"features": [5.1, 3.5, 1.4, 0.2]}'

Project Files

  • app.py - FastAPI application
  • simple_train.py - Model training script
  • test_api.py - API test suite
  • Dockerfile - Docker configuration
  • requirements.txt - Python dependencies
  • setup.sh - Automated setup script
  • SERVING_GUIDE.md - Complete documentation

What This Gives You

REST API for iris classification Trained model ready to serve Docker support for containerization Interactive docs at /docs Comprehensive tests included Production ready setup


API Usage Examples

Python

import requests
response = requests.post(
    "http://localhost:8000/predict",
    json={"features": [5.1, 3.5, 1.4, 0.2]}
)
print(response.json())  # {"prediction": 0, "features": [...]}

JavaScript

fetch("http://localhost:8000/predict", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ features: [5.1, 3.5, 1.4, 0.2] }),
})
  .then((r) => r.json())
  .then((data) => console.log(data));

cURL

curl -X POST "http://localhost:8000/predict" \
     -H "Content-Type: application/json" \
     -d '{"features": [5.1, 3.5, 1.4, 0.2]}'
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...