Spaces:
Runtime error
Runtime error
Commit
·
cb5b42f
1
Parent(s):
0e55060
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,7 @@ import streamlit as st
|
|
22 |
sys.path.append(os.path.abspath("../supv"))
|
23 |
from matumizi.util import *
|
24 |
from mcclf import *
|
|
|
25 |
|
26 |
def genVisitHistory(numUsers, convRate, label):
|
27 |
for i in range(numUsers):
|
@@ -111,13 +112,38 @@ def predictModel(mlfpath, userID):
|
|
111 |
res = model.predict(userID)
|
112 |
return res
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
# if __name__ == "__main__":
|
123 |
# st.title("Conversion Prediction App")
|
|
|
22 |
sys.path.append(os.path.abspath("../supv"))
|
23 |
from matumizi.util import *
|
24 |
from mcclf import *
|
25 |
+
from markov_chain_classifier import MarkovChainClassifier
|
26 |
|
27 |
def genVisitHistory(numUsers, convRate, label):
|
28 |
for i in range(numUsers):
|
|
|
112 |
res = model.predict(userID)
|
113 |
return res
|
114 |
|
115 |
+
|
116 |
+
# Define MLF path and user ID
|
117 |
+
mlfpath = "mcclf_cc.properties"
|
118 |
+
userID = "56C96HWLR9ZO"
|
119 |
+
|
120 |
+
# Load the Markov chain classifier model
|
121 |
+
model = MarkovChainClassifier('cc.mod')
|
122 |
+
|
123 |
+
# Perform prediction
|
124 |
+
result = model.predict(userID)
|
125 |
+
|
126 |
+
# Display the prediction result
|
127 |
+
st.title("Conversion Prediction App")
|
128 |
+
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.")
|
129 |
+
st.write("Prediction Result for User ID: ", userID)
|
130 |
+
st.write("Conversion: ", result)
|
131 |
+
|
132 |
+
|
133 |
+
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
|
140 |
+
# if op == "Predict":
|
141 |
+
# st.write("Enter the parameters to make a prediction:")
|
142 |
+
# userID = st.text_input("User ID")
|
143 |
+
# st.write("Click the button below to make a prediction")
|
144 |
+
# if st.button("Predict"):
|
145 |
+
# prediction = predictModel(mlfpath, userID)
|
146 |
+
# st.write("Prediction:", prediction)
|
147 |
|
148 |
# if __name__ == "__main__":
|
149 |
# st.title("Conversion Prediction App")
|