YeBhoneLin10 commited on
Commit
8df7a86
·
verified ·
1 Parent(s): 224cd09

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +23 -25
main.py CHANGED
@@ -1,25 +1,23 @@
1
- import streamlit as st
2
- import pickle
3
- import pandas as pd
4
-
5
- st.title("Classification the Iris")
6
-
7
- sepal_length = st.text_input('Sepal_Length (cm)')
8
- sepal_width = st.text_input('Sepal_Width (cm)')
9
- petal_length = st.text_input('Petal_Length (cm)')
10
- petal_width = st.text_input('Petal_Width (cm)')
11
-
12
- dataframe = pd.DataFrame({"sepal length (cm)":[sepal_length],"sepal width (cm)":[sepal_width],'petal length (cm)':[petal_length],'petal width (cm)':[petal_width]})
13
-
14
- if st.button('Prediction'):
15
- with open('model.pkl', 'rb') as file:
16
- loaded_model = pickle.load(file)
17
- final_output = loaded_model.predict(dataframe)
18
- if final_output == '0':
19
- st.write("The output class is setosa")
20
- elif final_output == '1':
21
- st.write("The output class is versicolor")
22
- elif final_output == '2':
23
- st.write("The output class is virginica")
24
-
25
-
 
1
+ import streamlit as st
2
+ import pickle
3
+ import pandas as pd
4
+
5
+ st.title("Classification the Iris")
6
+
7
+ sepal_length = st.text_input('Sepal_Length (cm)')
8
+ sepal_width = st.text_input('Sepal_Width (cm)')
9
+ petal_length = st.text_input('Petal_Length (cm)')
10
+ petal_width = st.text_input('Petal_Width (cm)')
11
+
12
+ dataframe = pd.DataFrame({"sepal length (cm)":[sepal_length],"sepal width (cm)":[sepal_width],'petal length (cm)':[petal_length],'petal width (cm)':[petal_width]})
13
+
14
+ if st.button('Prediction'):
15
+ with open('model.pkl', 'rb') as file:
16
+ loaded_model = pickle.load(file)
17
+ final_output = loaded_model.predict(dataframe)
18
+ if final_output == '0':
19
+ st.write("The output class is setosa")
20
+ elif final_output == '1':
21
+ st.write("The output class is versicolor")
22
+ elif final_output == '2':
23
+ st.write("The output class is virginica")