CoolFace
Apppublic

Akhdan/iris-apps

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py42 linesDownload Raw Back to root
1import streamlit as st2import pandas as pd3import joblib4 5with open('model.pkl', 'rb') as file_1:6  model = joblib.load(file_1) 7 8# widget input9st.title("Predict Iris")10 11with st.form(key= 'form_parameter'):12        sepal_length = st.number_input('Sepal Length (cm)')13        sepal_width = st.number_input('Sepal Width (cm)')14        petal_length = st.number_input('Petal Length (cm)')15        petal_width = st.number_input('Petal Width (cm)')16        st.markdown('---')17 18        submitted = st.form_submit_button('Predict')19 20data={21    'sepal length (cm)': sepal_length,22    'sepal width (cm)': sepal_width,23    'petal length (cm)': petal_length,24    'petal width (cm)': petal_width25}26 27data_inf = [sepal_length,sepal_width,petal_length,petal_width]28 29data = pd.DataFrame([data])30st.dataframe(data)31 32if submitted:33    proba_df = model.predict([data_inf])34 35    if proba_df == 0 :36        output= 'Setosa'37    elif proba_df == 1:38        output= 'Versicolor'39    elif proba_df== 2:40        output = 'Virginica'41 42    st.write('## Prediction = ', output )