Priyanka-Kumavat-At-TE commited on
Commit
b9df7d8
1 Parent(s): 1d09c8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -27
app.py CHANGED
@@ -111,34 +111,42 @@ def predictModel(mlfpath, userID):
111
  res = model.predict(userID)
112
  return res
113
 
114
- if __name__ == "__main__":
115
- st.title("Conversion Prediction App")
116
- st.write("Welcome to the Conversion Prediction App. This app uses a Markov chain based classifier to predict whether a customer will convert or not based on their visit history.")
117
-
118
- op = st.sidebar.selectbox("Select Operation", ["Generate Visit History", "Train Model", "Predict"])
119
-
120
- if op == "Generate Visit History":
121
- st.write("Enter the parameters to generate the visit history:")
122
- numUsers = st.number_input("Number of users", min_value=1, max_value=1000, value=100, step=1)
123
- convRate = st.number_input("Conversion Rate (in percentage)", min_value=0, max_value=100, value=10, step=1)
124
- label = st.checkbox("Add Labels")
125
- st.write("Click the button below to generate the visit history")
126
- if st.button("Generate"):
127
- genVisitHistory(numUsers, convRate, label)
 
 
 
 
 
 
 
 
128
 
129
- elif op == "Train Model":
130
- st.write("Train the model using the following parameters:")
131
- mlfpath = st.text_input("MLF Path")
132
- if st.button("Train"):
133
- trainModel(mlfpath)
134
-
135
- elif op == "Predict":
136
- st.write("Predict using the trained model:")
137
- mlfpath = st.text_input("MLF Path")
138
- userID = st.text_input("User ID")
139
- if st.button("Predict"):
140
- result = predictModel(mlfpath, userID)
141
- st.write("Prediction Result: ", result)
142
 
143
  # def main():
144
  # st.title("Markov Chain Classifier")
 
111
  res = model.predict(userID)
112
  return res
113
 
114
+ if op == "Predict":
115
+ st.write("Enter the parameters to make a prediction:")
116
+ userID = st.text_input("User ID")
117
+ st.write("Click the button below to make a prediction")
118
+ if st.button("Predict"):
119
+ prediction = predictModel(mlfpath, userID)
120
+ st.write("Prediction:", prediction)
121
+
122
+ # if __name__ == "__main__":
123
+ # st.title("Conversion Prediction App")
124
+ # st.write("Welcome to the Conversion Prediction App. This app uses a Markov chain based classifier to predict whether a customer will convert or not based on their visit history.")
125
+
126
+ # op = st.sidebar.selectbox("Select Operation", ["Generate Visit History", "Train Model", "Predict"])
127
+
128
+ # if op == "Generate Visit History":
129
+ # st.write("Enter the parameters to generate the visit history:")
130
+ # numUsers = st.number_input("Number of users", min_value=1, max_value=1000, value=100, step=1)
131
+ # convRate = st.number_input("Conversion Rate (in percentage)", min_value=0, max_value=100, value=10, step=1)
132
+ # label = st.checkbox("Add Labels")
133
+ # st.write("Click the button below to generate the visit history")
134
+ # if st.button("Generate"):
135
+ # genVisitHistory(numUsers, convRate, label)
136
 
137
+ # elif op == "Train Model":
138
+ # st.write("Train the model using the following parameters:")
139
+ # mlfpath = st.text_input("MLF Path")
140
+ # if st.button("Train"):
141
+ # trainModel(mlfpath)
142
+
143
+ # elif op == "Predict":
144
+ # st.write("Predict using the trained model:")
145
+ # mlfpath = st.text_input("MLF Path")
146
+ # userID = st.text_input("User ID")
147
+ # if st.button("Predict"):
148
+ # result = predictModel(mlfpath, userID)
149
+ # st.write("Prediction Result: ", result)
150
 
151
  # def main():
152
  # st.title("Markov Chain Classifier")