|
|
|
|
|
import streamlit as st |
|
import onnxruntime as rt |
|
import numpy as np |
|
|
|
|
|
sess = rt.InferenceSession("random_forest_iris.onnx") |
|
|
|
st.title("Iris Prediction with Random Forest") |
|
|
|
|
|
sepal_length = st.slider("Sepal Length", 0.0, 10.0, 5.0) |
|
sepal_width = st.slider("Sepal Width", 0.0, 10.0, 3.5) |
|
petal_length = st.slider("Petal Length", 0.0, 10.0, 2.5) |
|
petal_width = st.slider("Petal Width", 0.0, 10.0, 1.0) |
|
|
|
input_features = [sepal_length, sepal_width, petal_length, petal_width] |
|
|
|
|
|
if st.button("Predict"): |
|
input_array = np.array([input_features], dtype=np.float32) |
|
pred_onnx = sess.run(None, {'float_input': input_array}) |
|
st.write(f"Predicted class: {pred_onnx[0][0]}") |
|
|