Priyanka-Kumavat-At-TE commited on
Commit
2b0a296
·
1 Parent(s): 7882ad8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -130,17 +130,23 @@ def main():
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
  # Check if the "Predict" button was clicked
137
  if st.button("Predict"):
138
  # Call the predict method of the MarkovChainClassifier instance
139
  pred = model.predict()
140
  if pred == 'T':
141
- st.write("Prediction: Visitor is likely to convert into a customer.")
142
  else:
143
- st.write("Prediction: Visitor is unlikely to convert into a customer.")
144
 
145
  if __name__ == "__main__":
146
  main()
 
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("cc.mod")
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
  # Call the predict method of the MarkovChainClassifier instance
145
  pred = model.predict()
146
  if pred == 'T':
147
+ st.write(f"UserID: {user_id}, Prediction: Visitor is likely to convert into a customer.")
148
  else:
149
+ st.write(f"UserID: {user_id}, Prediction: Visitor is unlikely to convert into a customer.")
150
 
151
  if __name__ == "__main__":
152
  main()