sachithcheruvaturfynd commited on
Commit
771c079
·
verified ·
1 Parent(s): ea6ef8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -83
app.py CHANGED
@@ -1,86 +1,3 @@
1
- # import streamlit as st
2
- # import pickle
3
-
4
- # # Function to load pickle files
5
- # def read_pickle_files(pickle_file):
6
- # with open(pickle_file, 'rb') as f:
7
- # return pickle.load(f)
8
-
9
- # # Load the necessary pickle files
10
- # cross_sell_data = read_pickle_files("fynd.cross_sell_recommendations-000000000000000000000001s.pkl")
11
- # upsell_data = read_pickle_files("fynd.up_sell_recommendations_000000000000000000000002s.pkl")
12
- # uid_name_pairs = read_pickle_files("uid_name_pairs.pkl")
13
- # uid_image_html_pairs = read_pickle_files("uid_image_html_pairs.pkl")
14
-
15
- # # Create a mapping from product_id to product name for dropdown
16
- # product_name_to_id = {name: uid for name, uid in uid_name_pairs.items()}
17
-
18
- # # Create a reverse mapping from product_id to product_name for display purposes
19
- # product_id_to_name = {uid: name for name, uid in uid_name_pairs.items()}
20
-
21
- # # Function to extract product list from recommendation data
22
- # def extract_product_list(recommendation_data):
23
- # product_ids = [entry['product_id'] for entry in recommendation_data]
24
- # # Map the product IDs to names for the dropdown
25
- # return [product_id_to_name[product_id] for product_id in product_ids if product_id in product_id_to_name]
26
-
27
- # # Extract recommendations for a specific product_id
28
- # def get_recommendations(product_id, recommendation_data):
29
- # for product in recommendation_data:
30
- # if product['product_id'] == product_id:
31
- # return product['recommendations']
32
- # return []
33
-
34
- # # Streamlit App Layout
35
- # st.title("Cross-Sell & Up-Sell Recommendations")
36
-
37
- # # Dropdown for selecting recommendation type
38
- # recommendation_type = st.selectbox("Select recommendation type:", ["Cross-sell", "Up-sell"])
39
-
40
- # # Choose the appropriate data based on recommendation type
41
- # if recommendation_type == "Cross-sell":
42
- # recommendations_data = cross_sell_data
43
- # elif recommendation_type == "Up-sell":
44
- # recommendations_data = upsell_data
45
-
46
- # # Get the list of product names for the dropdown
47
- # product_list = extract_product_list(recommendations_data)
48
-
49
- # # Dropdown for selecting a product by name
50
- # selected_product_name = st.selectbox("Select a product:", product_list)
51
-
52
- # # Get the selected product's ID using the name
53
- # selected_product_id = product_name_to_id.get(selected_product_name)
54
-
55
- # # Display the image of the selected product using the image URL
56
- # if selected_product_id:
57
- # #st.subheader(f"Selected Product: {selected_product_name}")
58
-
59
- # # Check if the product's ID has an associated image HTML and use the image URL
60
- # if selected_product_id in uid_image_html_pairs:
61
- # image_url = uid_image_html_pairs[selected_product_id]
62
- # st.image(image_url, use_column_width=False, width=200) # Set width to make image smaller
63
-
64
- # # Display recommendations for the selected product
65
- # if selected_product_id:
66
- # recommendations = get_recommendations(selected_product_id, recommendations_data)
67
-
68
- # if recommendations:
69
- # #st.subheader(f"Recommendations:")
70
- # for recommendation in recommendations:
71
- # product_name = recommendation.get('product_name')
72
- # recommended_product_id = recommendation.get('product_id')
73
-
74
- # # Display the image of each recommended product using the image URL
75
- # if recommended_product_id in uid_image_html_pairs:
76
- # recommended_image_url = uid_image_html_pairs[recommended_product_id]
77
- # st.image(recommended_image_url, caption=product_name, use_column_width=False, width=150) # Set width to make images smaller
78
-
79
- # # Display the product name
80
- # st.write(f"Product Name: {product_name}")
81
- # else:
82
- # st.write("No recommendations found for this product.")
83
-
84
  import streamlit as st
85
  import pickle
86
  from html_information2 import html2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import pickle
3
  from html_information2 import html2