Spaces:
Runtime error
Runtime error
File size: 1,341 Bytes
80fafc0 badf1d7 80fafc0 d474b29 0c0194f d474b29 c7b5f81 4f1bd87 80fafc0 badf1d7 6300a71 80fafc0 6300a71 80fafc0 badf1d7 80fafc0 6300a71 80fafc0 6300a71 1cc7a07 6300a71 82aa9d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import joblib
import pandas as pd
import streamlit as st
from PIL import Image
image = Image.open('iris.png')
st.image(image, caption='Iris')
model = joblib.load('model_XG.joblib')
def main():
st.title("Iris's Class")
with st.form("questionaire"):
sepal_length = st.slider("Sepal_length(cm)", 0.0, 10.0, 0.1)
sepal_width = st.slider("Sepal_width(cm)", 0.0, 10.0, 0.1)
petal_length = st.slider("Petal_length(cm)", 0.0, 10.0, 0.1)
petal_width = st.slider("Petal_width(cm)", 0.0, 10.0, 0.1)
# clicked==True only when the button is clicked
clicked = st.form_submit_button("Predict class")
if clicked:
result=model.predict(pd.DataFrame({"sepal.length": [sepal_length],
"sepal.width": [sepal_width],
"petal.length": [petal_length],
"petal.width": [petal_width]}))
# Show prediction
if result[0] == 0:
result = "Iris-setosa"
st.image(image, caption='Iris')
elif result[0] == 1:
result = "Iris-versicolor"
else:
result = "Iris-virginica"
st.success(f"Your predicted class is {result}")
|