Spaces:
Runtime error
Runtime error
File size: 1,288 Bytes
80fafc0 badf1d7 80fafc0 bec2a37 c7b5f81 4f1bd87 80fafc0 badf1d7 6300a71 80fafc0 6300a71 80fafc0 badf1d7 80fafc0 6300a71 80fafc0 6300a71 82aa9d7 badf1d7 |
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 |
import joblib
import pandas as pd
import streamlit as st
st.image("shorturl.at/bKSZ8", width = 350)
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"
elif result[0] == 1:
result = "Iris-versicolor"
else:
result = "Iris-virginica"
st.success(f"Your predicted class is {result}")
if __name__ == "__main__":
main()
|