CoolFace
Apppublic

CandyMK/iris_app

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
iris_app.py31 linesDownload Raw Back to src
1import streamlit as st2import pandas as pd3import pickle4 5# Load Model6model = pickle.load(open('src/logreg_model.pkl', 'rb'))7st.title('Iris Variety Prediction')8 9# Form10with st.form(key='form_parameters'):11   sepal_length = st.slider('Sepal Length', 4.0, 8.0, 4.0)12   sepal_width = st.slider('Sepal Width', 2.0, 4.5, 2.0)13   petal_length = st.slider('Petal Length', 1.0, 7.0, 1.0)14   petal_width = st.slider('Petal Width', 0.1, 2.5, 0.1)15   st.markdown('---')16   submitted = st.form_submit_button('Predict')17   18# Data Inference19data_inf = {20   'sepal.length': sepal_length,21   'sepal.width': sepal_width,22   'petal.length': petal_length,23   'petal.width': petal_width24}25 26data_inf = pd.DataFrame([data_inf])27 28if submitted:29   # Predict using Logistic Regression30   y_pred_inf = model.predict(data_inf)31   st.write('## Iris Variety = '+ str(y_pred_inf))