Application Iris Dataset
Browse files- README.md +4 -4
- app.py +24 -0
- random_forest_iris.onnx +3 -0
- requirements.txt +5 -0
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: yellow
|
5 |
-
colorTo:
|
6 |
sdk: streamlit
|
7 |
-
sdk_version: 1.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
1 |
---
|
2 |
+
title: Info7390 Deploy
|
3 |
+
emoji: π
|
4 |
colorFrom: yellow
|
5 |
+
colorTo: blue
|
6 |
sdk: streamlit
|
7 |
+
sdk_version: 1.25.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app_iris.py
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
import onnxruntime as rt
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
# Load the trained ONNX model
|
8 |
+
sess = rt.InferenceSession("random_forest_iris.onnx")
|
9 |
+
|
10 |
+
st.title("Iris Prediction with Random Forest")
|
11 |
+
|
12 |
+
# Input features
|
13 |
+
sepal_length = st.slider("Sepal Length", 0.0, 10.0, 5.0)
|
14 |
+
sepal_width = st.slider("Sepal Width", 0.0, 10.0, 3.5)
|
15 |
+
petal_length = st.slider("Petal Length", 0.0, 10.0, 2.5)
|
16 |
+
petal_width = st.slider("Petal Width", 0.0, 10.0, 1.0)
|
17 |
+
|
18 |
+
input_features = [sepal_length, sepal_width, petal_length, petal_width]
|
19 |
+
|
20 |
+
# Predict
|
21 |
+
if st.button("Predict"):
|
22 |
+
input_array = np.array([input_features], dtype=np.float32)
|
23 |
+
pred_onnx = sess.run(None, {'float_input': input_array})
|
24 |
+
st.write(f"Predicted class: {pred_onnx[0][0]}")
|
random_forest_iris.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7850ccd707ca0c8fabf5ab3c287a8cda49b4e8c268c52c9cd4784eeef5c35c86
|
3 |
+
size 80984
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
onnx
|
3 |
+
onnxruntime
|
4 |
+
skl2onnx
|
5 |
+
numpy
|