vinsensius13 commited on
Commit Β·
56a0995
1
Parent(s): beb7870
komitduawe
Browse files
README.md
CHANGED
|
@@ -1,111 +1,10 @@
|
|
| 1 |
-
# πΈ Iris Classifier API πΈ
|
| 2 |
-
|
| 3 |
-
A simple Flask API that predicts the species of iris flowers using a pre-trained Scikit-Learn model.
|
| 4 |
-
This app is deployed on [Hugging Face Spaces](https://huggingface.co/spaces/vnsd13/iris) and served via Docker using Gunicorn.
|
| 5 |
-
|
| 6 |
-
---
|
| 7 |
-
|
| 8 |
-
## π What is this?
|
| 9 |
-
|
| 10 |
-
This API receives 4 numeric features from the Iris dataset:
|
| 11 |
-
|
| 12 |
-
* Sepal Length
|
| 13 |
-
* Sepal Width
|
| 14 |
-
* Petal Length
|
| 15 |
-
* Petal Width
|
| 16 |
-
|
| 17 |
-
And returns the predicted iris species using a `DecisionTreeClassifier`.
|
| 18 |
-
|
| 19 |
-
---
|
| 20 |
-
|
| 21 |
-
## π Model
|
| 22 |
-
|
| 23 |
-
* Trained with `scikit-learn==1.6.1`
|
| 24 |
-
* Saved with `joblib`
|
| 25 |
-
* Stored in `models/model.pkl`
|
| 26 |
-
|
| 27 |
-
---
|
| 28 |
-
|
| 29 |
-
## π How to Use
|
| 30 |
-
|
| 31 |
-
### πͺͺ API Endpoints
|
| 32 |
-
|
| 33 |
-
#### `GET /`
|
| 34 |
-
|
| 35 |
-
Returns basic info to confirm that the app is running.
|
| 36 |
-
|
| 37 |
-
**Response:**
|
| 38 |
-
|
| 39 |
-
```
|
| 40 |
-
Iris Classifier API is running!
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
---
|
| 44 |
-
|
| 45 |
-
#### `POST /predict`
|
| 46 |
-
|
| 47 |
-
Predict the iris flower class based on features.
|
| 48 |
-
|
| 49 |
-
**Request Body (JSON):**
|
| 50 |
-
|
| 51 |
-
```json
|
| 52 |
-
{
|
| 53 |
-
"sepal_length": 5.1,
|
| 54 |
-
"sepal_width": 3.5,
|
| 55 |
-
"petal_length": 1.4,
|
| 56 |
-
"petal_width": 0.2
|
| 57 |
-
}
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
**Response:**
|
| 61 |
-
|
| 62 |
-
```json
|
| 63 |
-
{
|
| 64 |
-
"prediction": "setosa"
|
| 65 |
-
}
|
| 66 |
-
```
|
| 67 |
-
|
| 68 |
---
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
FROM python:3.10
|
| 76 |
-
|
| 77 |
-
WORKDIR /app
|
| 78 |
-
|
| 79 |
-
COPY requirements.txt .
|
| 80 |
-
RUN pip install -r requirements.txt
|
| 81 |
-
|
| 82 |
-
COPY . .
|
| 83 |
-
|
| 84 |
-
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
-
---
|
| 88 |
-
|
| 89 |
-
## π Requirements
|
| 90 |
-
|
| 91 |
-
```
|
| 92 |
-
flask
|
| 93 |
-
numpy
|
| 94 |
-
scikit-learn==1.6.1
|
| 95 |
-
joblib
|
| 96 |
-
gunicorn
|
| 97 |
-
```
|
| 98 |
-
|
| 99 |
---
|
| 100 |
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
This API is currently deployed to Hugging Face Spaces using Docker interface.
|
| 104 |
-
|
| 105 |
-
URL: [https://vnsd13-iris.hf.space](https://vnsd13-iris.hf.space)
|
| 106 |
-
|
| 107 |
-
---
|
| 108 |
-
|
| 109 |
-
## π¨βπ» Author
|
| 110 |
-
|
| 111 |
-
Made by [@vnsd13](https://huggingface.co/vnsd13)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Iris
|
| 3 |
+
emoji: π»
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|