Ropiudin16 commited on
Commit
92e1e29
1 Parent(s): a5091fc
Files changed (3) hide show
  1. app.py +43 -0
  2. milk_pred.pkl +3 -0
  3. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import pickle
4
+
5
+ st.title("--Insert title here--")
6
+
7
+ # Step 1 - import saved model
8
+ model = pickle.load(open("milk_pred.pkl", "rb"))
9
+
10
+ st.write('Insert feature to predict')
11
+
12
+ # Step 2 - prepare input data for user
13
+ ph = st.slider(label='pH', min_value=3.0, max_value=9.5, value=6.5, step=0.1)
14
+ temp = st.slider(label='Temprature', min_value=34, max_value=90, value=40, step=1)
15
+ taste = st.selectbox(label='Taste', options=['Good', 'Bad'], key=1)
16
+ odor = st.selectbox(label='Odor', options=['Good', 'Bad'])
17
+ fat = st.selectbox(label='Fat', options=['High', 'Low'])
18
+ turb = st.selectbox(label='Turbidity', options=['High', 'Low'])
19
+ color = st.number_input(label='Colour', min_value=240, max_value=255, value=245, step=1)
20
+
21
+ # convert into dataframe
22
+ data = pd.DataFrame({'pH': [ph],
23
+ 'Temprature': [temp],
24
+ 'Taste': [taste],
25
+ 'Odor':[odor],
26
+ 'Fat': [fat],
27
+ 'Turbidity': [turb],
28
+ 'Colour': [color]
29
+ })
30
+ st.write(data)
31
+ # model predict
32
+ clas = model.predict(data).tolist()[0]
33
+
34
+ # interpretation
35
+ st.write('Classification Result: ')
36
+ if clas == 0:
37
+ st.text('Low')
38
+ elif clas == 1:
39
+ st.text('Medium')
40
+ else:
41
+ st.text('High')
42
+
43
+
milk_pred.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b2f76b67e9b8663a9598ea2cde68a0ee9f88cef6e82e93fc44c32c249687568
3
+ size 271620
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ scikit-learn==1.0.2
4
+ feature_engine==1.5.1