pinkandjani20 commited on
Commit Β·
82d217d
1
Parent(s): 89ccb85
second commit
Browse files
README.md
CHANGED
|
@@ -1,66 +1,10 @@
|
|
| 1 |
-
# π Iris Flower Classification with Decision Tree
|
| 2 |
-
|
| 3 |
-
> **A simple machine learning project to classify Iris flowers using a Decision Tree model, built with Flask and Docker.**
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
## π Project Overview
|
| 7 |
-
This project demonstrates how to build, train, and deploy a Decision Tree classifier for the famous Iris flower dataset. The model is served as a REST API using Flask, and can be containerized with Docker for easy deployment.
|
| 8 |
-
|
| 9 |
-
## π Project Structure
|
| 10 |
-
|
| 11 |
-
- `app.py` β Flask API for model inference
|
| 12 |
-
- `decision_tree_model.pkl` β Trained Decision Tree model
|
| 13 |
-
- `Tugas_12_Iris_Flower_Classification_with_Decision_Tree.ipynb` β Jupyter Notebook for EDA, training, and evaluation
|
| 14 |
-
- `requirements.txt` β Python dependencies
|
| 15 |
-
- `Dockerfile` β Containerization setup
|
| 16 |
-
- `README.md` β Project documentation
|
| 17 |
-
|
| 18 |
-
## π How to Run Locally
|
| 19 |
-
|
| 20 |
-
1. **Clone the repository**
|
| 21 |
-
2. **Create a virtual environment & install dependencies**
|
| 22 |
-
```bash
|
| 23 |
-
python -m venv venv
|
| 24 |
-
venv\Scripts\activate
|
| 25 |
-
pip install -r requirements.txt
|
| 26 |
-
```
|
| 27 |
-
3. **Train the model (if not already trained)**
|
| 28 |
-
- Run the notebook `Tugas_12_Iris_Flower_Classification_with_Decision_Tree.ipynb` to generate `decision_tree_model.pkl`.
|
| 29 |
-
4. **Start the Flask API**
|
| 30 |
-
```bash
|
| 31 |
-
python app.py
|
| 32 |
-
```
|
| 33 |
-
5. **Test the API**
|
| 34 |
-
- Send a POST request to `http://localhost:7860/predict` with JSON body:
|
| 35 |
-
```json
|
| 36 |
-
{ "data": [5.1, 3.5, 1.4, 0.2] }
|
| 37 |
-
```
|
| 38 |
-
- Response:
|
| 39 |
-
```json
|
| 40 |
-
{ "prediksi_spesies": "setosa" }
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
## π³ Run with Docker
|
| 44 |
-
|
| 45 |
-
1. **Build the Docker image**
|
| 46 |
-
```bash
|
| 47 |
-
docker build -t iris-dt-api .
|
| 48 |
-
```
|
| 49 |
-
2. **Run the container**
|
| 50 |
-
```bash
|
| 51 |
-
docker run -p 7860:7860 iris-dt-api
|
| 52 |
-
```
|
| 53 |
-
|
| 54 |
-
## π Notebook Features
|
| 55 |
-
- Exploratory Data Analysis (EDA)
|
| 56 |
-
- Model training & evaluation
|
| 57 |
-
- Visualization of the Decision Tree
|
| 58 |
-
- Model export with `joblib`
|
| 59 |
-
|
| 60 |
-
## π References
|
| 61 |
-
- [Scikit-learn Iris Dataset](https://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html)
|
| 62 |
-
- [Flask Documentation](https://flask.palletsprojects.com/)
|
| 63 |
-
- [Docker Documentation](https://docs.docker.com/)
|
| 64 |
-
|
| 65 |
---
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Classification With Decision Tree
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|