Priyanka-Kumavat-At-TE commited on
Commit
662ab56
1 Parent(s): be696f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -23
app.py CHANGED
@@ -121,35 +121,53 @@ def main():
121
 
122
  elif app_mode == "Predict Conversion":
123
  st.subheader("Predict Conversion")
124
- # Upload ML config file using Streamlit's file_uploader function
125
- mlf_file = st.file_uploader("Upload ML config file", type=["properties"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
- # Check if ML config file was uploaded
128
- if mlf_file is not None:
129
- # Save the uploaded file to a local file
130
- with open("mcclf_cc.properties", "wb") as f:
131
- f.write(mlf_file.read())
132
 
133
- # Create an instance of MarkovChainClassifier with the uploaded ML config file
134
- model = MarkovChainClassifier("mcclf_cc.properties")
135
 
136
- # # Load the model from cc.mod
137
- # model = MarkovChainClassifier.load_model("cc.mod")
138
 
139
- # Get user input for userID
140
- user_id = st.text_input("Enter User ID")
141
 
142
- # Check if the "Predict" button was clicked
143
- if st.button("Predict"):
144
- # Load the saved model
145
- # model.load_model("cc.mod")
146
 
147
- # Call the predict method of the MarkovChainClassifier instance
148
- pred = model.predict()
149
- if pred == 'T':
150
- st.write(f"UserID: {user_id}, Prediction: Visitor is likely to convert into a customer.")
151
- else:
152
- st.write(f"UserID: {user_id}, Prediction: Visitor is unlikely to convert into a customer.")
153
 
154
  if __name__ == "__main__":
155
  main()
 
121
 
122
  elif app_mode == "Predict Conversion":
123
  st.subheader("Predict Conversion")
124
+
125
+ # Create an instance of MarkovChainClassifier with the ML config file
126
+ model = MarkovChainClassifier("cc.mod")
127
+
128
+ # Get user input for userID
129
+ user_id = st.text_input("Enter User ID")
130
+
131
+ # Check if the "Predict" button was clicked
132
+ if st.button("Predict"):
133
+
134
+ # Call the predict method of the MarkovChainClassifier instance
135
+ pred = model.predict()
136
+ if pred == 'T':
137
+ st.write(f"UserID: {user_id}, Prediction: Visitor is likely to convert into a customer.")
138
+ else:
139
+ st.write(f"UserID: {user_id}, Prediction: Visitor is unlikely to convert into a customer.")
140
+
141
+ # st.subheader("Predict Conversion")
142
+ # # Upload ML config file using Streamlit's file_uploader function
143
+ # mlf_file = st.file_uploader("Upload ML config file", type=["properties"])
144
 
145
+ # # Check if ML config file was uploaded
146
+ # if mlf_file is not None:
147
+ # # Save the uploaded file to a local file
148
+ # with open("mcclf_cc.properties", "wb") as f:
149
+ # f.write(mlf_file.read())
150
 
151
+ # # Create an instance of MarkovChainClassifier with the uploaded ML config file
152
+ # model = MarkovChainClassifier("mcclf_cc.properties")
153
 
154
+ # # # Load the model from cc.mod
155
+ # # model = MarkovChainClassifier.load_model("cc.mod")
156
 
157
+ # # Get user input for userID
158
+ # user_id = st.text_input("Enter User ID")
159
 
160
+ # # Check if the "Predict" button was clicked
161
+ # if st.button("Predict"):
162
+ # # Load the saved model
163
+ # # model.load_model("cc.mod")
164
 
165
+ # # Call the predict method of the MarkovChainClassifier instance
166
+ # pred = model.predict()
167
+ # if pred == 'T':
168
+ # st.write(f"UserID: {user_id}, Prediction: Visitor is likely to convert into a customer.")
169
+ # else:
170
+ # st.write(f"UserID: {user_id}, Prediction: Visitor is unlikely to convert into a customer.")
171
 
172
  if __name__ == "__main__":
173
  main()