-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
26 lines (22 loc) · 1.13 KB
/
app.py
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
import streamlit as st
import pickle
import pandas as pd
#reading the encoder, model and scaler object files
encoder = pickle.load(open("encoder.pkl", 'rb'))
model = pickle.load(open("model.pkl", 'rb'))
scaler = pickle.load(open("scaler.pkl", 'rb'))
#setting the title and text
st.title("🌼Iris Flower Classification")
st.write("*Developed for 🌎 with ❤️🔥 by Sohaib👨🏻💻🇵🇰*")
#taking the input from user
new_SL = st.number_input("Enter sepalLength (cm):", min_value=0.0, max_value=10.0, step=0.1)
new_SW = st.number_input("Enter sepalWidth (cm):", min_value=0.0, max_value=10.0, step=0.1)
new_PL = st.number_input("Enter petalLength (cm):", min_value=0.0, max_value=10.0, step=0.1)
new_PW = st.number_input("Enter petalWidth (cm):", min_value=0.0, max_value=10.0, step=0.1)
#button to trigger the classification
if st.button("Classify"):
new_value = pd.DataFrame([[new_SL, new_SW, new_PL, new_PW]])
new_value_scaled = scaler.transform(new_value)
prediction = model.predict(new_value_scaled)
finalans = encoder.inverse_transform(prediction)
st.markdown(f"Prediction result: **{finalans[0]}**")