Spaces:
Sleeping
Sleeping
| title: Iris Detector | |
| emoji: 🌸 | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: gradio | |
| sdk_version: "5.49.1" | |
| app_file: app.py | |
| pinned: false | |
| # 🌸 Iris Detector | |
| A simple Gradio Space that predicts iris species using a K-Nearest Neighbors classifier (k=5). | |
| ## Features | |
| - 4 numeric inputs: sepal length, sepal width, petal length, petal width | |
| - Predicts one of 3 classes: `setosa`, `versicolor`, `virginica` | |
| - Shows probability distribution | |
| - Exposes API endpoint `/run/predict` for programmatic access | |
| ## API Usage | |
| **Endpoint:** | |
| ``` | |
| POST https://huggingface.co/spaces/tofighi/iris-detector/run/predict | |
| ``` | |
| **Request Body Example:** | |
| ```json | |
| { | |
| "data": [[5.1, 3.5, 1.4, 0.2]] | |
| } | |
| ``` | |
| **Response Example:** | |
| ```json | |
| { | |
| "data": [ | |
| { | |
| "predicted_class": "setosa", | |
| "probabilities": { | |
| "setosa": 1.0, | |
| "versicolor": 0.0, | |
| "virginica": 0.0 | |
| } | |
| } | |
| ] | |
| } | |
| ``` | |
| **Python Example:** | |
| ```python | |
| import requests | |
| url = "https://huggingface.co/spaces/tofighi/iris-detector/run/predict" | |
| payload = {"data": [[5.1, 3.5, 1.4, 0.2]]} | |
| resp = requests.post(url, json=payload) | |
| print(resp.json()) | |
| ``` |