Mummia-99 commited on
Commit
f8717f8
·
verified ·
1 Parent(s): d041628

Upload 3 files

Browse files
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as np
3
+ import joblib
4
+
5
+ html_temp = """
6
+ <div style="background-color:black;padding:10px">
7
+ <h2 style="color:white;text-align:center;">Customer Clustering App </h2>
8
+ </div>
9
+ """
10
+ st.markdown(html_temp, unsafe_allow_html=True)
11
+
12
+ image_url="https://tse4.mm.bing.net/th?id=OIP.Sri9wahqIBdLwFTc85-tvgHaEK&pid=Api&P=0&h=180"
13
+
14
+ st.image(image_url, caption="Image from URL", use_container_width=True)
15
+
16
+ km_model=joblib.load("coffe_customer_prediction_model.joblib")
17
+
18
+ def clustering(monetary, frequency):
19
+ new_customer = np.array([[monetary, frequency]])
20
+ predicted_cluster = km_model.predict(new_customer)
21
+
22
+ if predicted_cluster[0]==1:
23
+ return "Daily"
24
+ else:
25
+ return "Weekely"
26
+
27
+ monetary=float(st.slider("Slide Size of the monetary",min_value=1,max_value=459,value=1))
28
+
29
+ frequency=float(st.slider("Slide Size of the frequency",min_value=1,max_value=25,value=1))
30
+
31
+ if st.button("Submit"):
32
+ predicted_cluster = clustering(monetary, frequency)
33
+
34
+ st.write(f'New Customer assigned to Cluster: {predicted_cluster}')
coffe_customer_prediction_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:980a5db97ce427442ac3b5a8ab752d6aca07127e26e286965f5506a97bd7249a
3
+ size 10083
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ joblib==1.2.0
2
+ matplotlib==3.7.1
3
+ matplotlib-inline==0.1.6
4
+ numpy==1.26.4
5
+ pandas==1.5.3
6
+ scikit-learn==1.6.0
7
+ streamlit==1.41.1