Are you sure you want to delete this access key?
# 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 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]}'
# 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]}'
app.py
- FastAPI applicationsimple_train.py
- Model training scripttest_api.py
- API test suiteDockerfile
- Docker configurationrequirements.txt
- Python dependenciessetup.sh
- Automated setup scriptSERVING_GUIDE.md
- Complete documentationREST API for iris classification
Trained model ready to serve
Docker support for containerization
Interactive docs at /docs
Comprehensive tests included
Production ready setup
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": [...]}
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 -X POST "http://localhost:8000/predict" \
-H "Content-Type: application/json" \
-d '{"features": [5.1, 3.5, 1.4, 0.2]}'
Press p or to see the previous file or, n or to see the next file
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?