import streamlit as st import numpy as np import joblib html_temp = """

Customer Clustering App

""" st.markdown(html_temp, unsafe_allow_html=True) image_url="https://tse4.mm.bing.net/th?id=OIP.Sri9wahqIBdLwFTc85-tvgHaEK&pid=Api&P=0&h=180" st.image(image_url, use_container_width=True) st.markdown(f""" """, unsafe_allow_html=True) km_model=joblib.load("coffe_customer_prediction_model.joblib") def clustering(monetary, frequency): new_customer = np.array([[monetary, frequency]]) predicted_cluster = km_model.predict(new_customer) if predicted_cluster[0]==1: return "Daily" else: return "Weekely" monetary=float(st.slider("Slide Size of the monetary",min_value=1,max_value=459,value=1)) frequency=float(st.slider("Slide Size of the frequency",min_value=1,max_value=25,value=1)) if st.button("Submit"): predicted_cluster = clustering(monetary, frequency) st.text_area("",f'New Customer assigned to Cluster: {predicted_cluster}') st.write("")