Nav772 commited on
Commit
0ccd2b3
·
verified ·
1 Parent(s): f224aec

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +27 -5
  2. app.py +45 -0
  3. metrics.json +42 -0
  4. model.pkl +3 -0
  5. requirements.txt +3 -0
README.md CHANGED
@@ -1,12 +1,34 @@
1
  ---
2
- title: Iris Classifier Cicd
3
- emoji: 📚
4
- colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 6.5.1
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Iris Classifier (CI/CD Demo)
3
+ emoji: 🌸
4
+ colorFrom: pink
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 5.29.0
8
  app_file: app.py
9
  pinned: false
10
+ license: mit
11
  ---
12
 
13
+ # Iris Classifier (CI/CD Demo)
14
+
15
+ A simple Iris flower classifier demonstrating automated ML deployment via GitHub Actions.
16
+
17
+ ## CI/CD Pipeline
18
+
19
+ This model is automatically:
20
+ 1. **Validated** - Data quality checks
21
+ 2. **Tested** - Unit tests for training code
22
+ 3. **Trained** - Model training with accuracy threshold
23
+ 4. **Deployed** - Pushed to this HuggingFace Space
24
+
25
+ ## Model Details
26
+
27
+ - **Algorithm:** Random Forest (100 trees)
28
+ - **Dataset:** Iris (150 samples, 3 classes)
29
+ - **Accuracy:** 90.0%
30
+
31
+ ## Links
32
+
33
+ - [GitHub Repository](https://github.com/Algo-nav/ml-pipeline-demo)
34
+ - [Author: Nav772](https://huggingface.co/Nav772)
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pickle
3
+ import numpy as np
4
+ import json
5
+
6
+ with open("model.pkl", "rb") as f:
7
+ model = pickle.load(f)
8
+
9
+ with open("metrics.json", "r") as f:
10
+ metrics = json.load(f)
11
+
12
+ CLASS_NAMES = ["Setosa", "Versicolor", "Virginica"]
13
+
14
+
15
+ def predict(sepal_length, sepal_width, petal_length, petal_width):
16
+ features = np.array([[sepal_length, sepal_width, petal_length, petal_width]])
17
+ probabilities = model.predict_proba(features)[0]
18
+ result = {CLASS_NAMES[i]: float(prob) for i, prob in enumerate(probabilities)}
19
+ return result
20
+
21
+
22
+ demo = gr.Interface(
23
+ fn=predict,
24
+ inputs=[
25
+ gr.Slider(4.0, 8.0, value=5.8, label="Sepal Length (cm)"),
26
+ gr.Slider(2.0, 4.5, value=3.0, label="Sepal Width (cm)"),
27
+ gr.Slider(1.0, 7.0, value=4.0, label="Petal Length (cm)"),
28
+ gr.Slider(0.1, 2.5, value=1.2, label="Petal Width (cm)"),
29
+ ],
30
+ outputs=gr.Label(num_top_classes=3, label="Prediction"),
31
+ title="Iris Classifier (CI/CD Demo)",
32
+ description=(
33
+ "Classify Iris flowers based on sepal and petal measurements. "
34
+ "Model Performance: 90.0% accuracy. "
35
+ "This model was automatically trained and deployed via GitHub Actions CI/CD."
36
+ ),
37
+ examples=[
38
+ [5.1, 3.5, 1.4, 0.2],
39
+ [6.2, 2.9, 4.3, 1.3],
40
+ [7.7, 3.0, 6.1, 2.3],
41
+ ]
42
+ )
43
+
44
+ if __name__ == "__main__":
45
+ demo.launch()
metrics.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "accuracy": 0.9,
3
+ "classification_report": {
4
+ "setosa": {
5
+ "precision": 1.0,
6
+ "recall": 1.0,
7
+ "f1-score": 1.0,
8
+ "support": 10.0
9
+ },
10
+ "versicolor": {
11
+ "precision": 0.8181818181818182,
12
+ "recall": 0.9,
13
+ "f1-score": 0.8571428571428571,
14
+ "support": 10.0
15
+ },
16
+ "virginica": {
17
+ "precision": 0.8888888888888888,
18
+ "recall": 0.8,
19
+ "f1-score": 0.8421052631578947,
20
+ "support": 10.0
21
+ },
22
+ "accuracy": 0.9,
23
+ "macro avg": {
24
+ "precision": 0.9023569023569024,
25
+ "recall": 0.9,
26
+ "f1-score": 0.899749373433584,
27
+ "support": 30.0
28
+ },
29
+ "weighted avg": {
30
+ "precision": 0.9023569023569024,
31
+ "recall": 0.9,
32
+ "f1-score": 0.8997493734335839,
33
+ "support": 30.0
34
+ }
35
+ },
36
+ "parameters": {
37
+ "n_estimators": 100,
38
+ "test_size": 0.2,
39
+ "random_state": 42
40
+ },
41
+ "timestamp": "2026-02-03T14:49:10.698036"
42
+ }
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fb1ecd200ca029ac4bd7ea3d59b5685440a85dcc01f4a3a7efabc0782d0be18
3
+ size 158032
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ numpy
3
+ scikit-learn