Spaces:
Runtime error
Runtime error
Commit
·
b9df7d8
1
Parent(s):
1d09c8e
Update app.py
Browse files
app.py
CHANGED
|
@@ -111,34 +111,42 @@ def predictModel(mlfpath, userID):
|
|
| 111 |
res = model.predict(userID)
|
| 112 |
return res
|
| 113 |
|
| 114 |
-
if
|
| 115 |
-
st.
|
| 116 |
-
st.
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 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")
|