Spaces:
Sleeping
Sleeping
Upload 9 files
Browse files- all_products_with_names.pkl +3 -0
- app.py +662 -0
- corrected_fp_growth_results.pkl +3 -0
- html_information.py +72 -0
- html_information2.py +72 -0
- item_catalog.pkl +3 -0
- reliance_digital_transactions.pkl +3 -0
- sephora_corrected_fp_growth_results_cleaned.pkl +3 -0
- transaction_metadata.pkl +3 -0
all_products_with_names.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2990e4a3d8e1326a0d6f211fe61bb58a05709490b6a20c8bad6ce2314ca2caf1
|
3 |
+
size 476664
|
app.py
ADDED
@@ -0,0 +1,662 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import pickle
|
2 |
+
# import streamlit as st
|
3 |
+
# from html_information import html
|
4 |
+
# from html_information2 import html2
|
5 |
+
|
6 |
+
# import streamlit as st
|
7 |
+
|
8 |
+
# st.set_page_config(page_title="My App", page_icon=":money_with_wings:", layout="wide", initial_sidebar_state="auto")
|
9 |
+
# st.header("Frequently Bought Together Recommendations")
|
10 |
+
|
11 |
+
# def read_pickle_files(pickle_file):
|
12 |
+
# with open(pickle_file, 'rb') as f:
|
13 |
+
# return pickle.load(f)
|
14 |
+
|
15 |
+
# def get_mapped_values(uid_list, dict_map):
|
16 |
+
# res = []
|
17 |
+
# for val in uid_list:
|
18 |
+
# try:
|
19 |
+
# res.append(dict_map[val])
|
20 |
+
# except:
|
21 |
+
# continue
|
22 |
+
# return res
|
23 |
+
|
24 |
+
# # Load sephora pickle files
|
25 |
+
# filtered_products_list = read_pickle_files("filtered_products_list.pkl")
|
26 |
+
# recommendation_products_list = read_pickle_files("recommendation_products_list.pkl")
|
27 |
+
# transactions_list = read_pickle_files("transactions.pkl")
|
28 |
+
# bought_together_dict = read_pickle_files("bought_together_dict_orders_data.pkl")
|
29 |
+
# uid_name_map = read_pickle_files("uid_name_map.pkl")
|
30 |
+
# uid_url_map = read_pickle_files("uid_url_map.pkl")
|
31 |
+
|
32 |
+
# # Load digital pickle files
|
33 |
+
# #transactions_list_digital = read_pickle_files("transaction_digital.pkl")
|
34 |
+
# # bought_together_dict_digital = read_pickle_files("bought_together_dictionary_without_names.pkl")
|
35 |
+
# corrected_fp_growth_results = read_pickle_files("corrected_fp_growth_results.pkl")
|
36 |
+
# #list_of_products_to_display = read_pickle_files("list_of_products_to_display_pickle.pkl") # all products
|
37 |
+
# all_products_with_names = read_pickle_files ("all_products_with_names.pkl")
|
38 |
+
# dictionary_of_transactions = read_pickle_files("reliance_digital_transactions.pkl")
|
39 |
+
|
40 |
+
# # Create product dictionary
|
41 |
+
# product_dict = {item['product_id']: item for item in filtered_products_list}
|
42 |
+
|
43 |
+
# # Dropdown for selecting the dataset
|
44 |
+
# dataset_choice = st.selectbox(
|
45 |
+
# "Select A Dataset",
|
46 |
+
# ["Sephora Order Complete Dataset", "Reliance Digital Order Complete Dataset"]
|
47 |
+
# )
|
48 |
+
|
49 |
+
# if dataset_choice == "Sephora Order Complete Dataset":
|
50 |
+
# # Dropdown for selecting a product
|
51 |
+
# uid_list = list(product_dict)
|
52 |
+
# uid_name_list = get_mapped_values(uid_list, uid_name_map)
|
53 |
+
# index = st.selectbox(
|
54 |
+
# "Select A Product From The Drop Down Menu",
|
55 |
+
# range(len(uid_name_list)),
|
56 |
+
# format_func=lambda x: uid_name_list[x]
|
57 |
+
# )
|
58 |
+
# query_id = uid_list[index]
|
59 |
+
# query_url = uid_url_map[query_id]
|
60 |
+
# url = "https://www.sephora.com/"
|
61 |
+
# st.write("Created using the clickstream order-completed and catalog data from [Sephora.com](%s)" % url)
|
62 |
+
# st.image(query_url, width=500)
|
63 |
+
|
64 |
+
# if dataset_choice == "Reliance Digital Order Complete Dataset":
|
65 |
+
# list_of_products_to_display = {}
|
66 |
+
# for itemid in (list(all_products_with_names.keys())): #for items in the total list of items in all transactions
|
67 |
+
# if itemid in (list(corrected_fp_growth_results.keys())): #if the item has a result from fp-growth
|
68 |
+
# list_of_products_to_display[itemid]= all_products_with_names[itemid] #show it in the drop down menu
|
69 |
+
|
70 |
+
# name_to_id = {name: product_id for product_id, name in list_of_products_to_display.items()} # Reverse the dictionary to map product names to IDs
|
71 |
+
# selected_product_name = st.selectbox('Select A Product:', list(name_to_id.keys())) # Create a dropdown menu with the product names
|
72 |
+
|
73 |
+
# # Get the corresponding product_id
|
74 |
+
# query_id = name_to_id[selected_product_name]
|
75 |
+
# url = "https://www.reliancedigital.in/"
|
76 |
+
# st.write("Created using the clickstream order-completed data from [reliancedigital.com](%s)" % url)
|
77 |
+
|
78 |
+
# # Inject custom CSS for the tab headings
|
79 |
+
# st.markdown(
|
80 |
+
# """
|
81 |
+
# <style>
|
82 |
+
# /* Style the tab container */
|
83 |
+
# div[data-testid="stTabs"] button {
|
84 |
+
# background-color: #e0e0e0; /* Light grey background */
|
85 |
+
# color: #333333; /* Dark grey text color */
|
86 |
+
# font-size: 18px; /* Increase font size */
|
87 |
+
# font-weight: bold; /* Make text bold */
|
88 |
+
# padding: 10px 20px; /* Add some padding to the tabs */
|
89 |
+
# border-radius: 10px; /* Rounded corners */
|
90 |
+
# border: none; /* Remove default border */
|
91 |
+
# margin: 5px; /* Add margin between tabs */
|
92 |
+
# transition: background-color 0.3s ease; /* Add hover effect */
|
93 |
+
# }
|
94 |
+
|
95 |
+
# /* Hover effect for tabs */
|
96 |
+
# div[data-testid="stTabs"] button:hover {
|
97 |
+
# background-color: #b0b0b0; /* Darker grey on hover */
|
98 |
+
# color: #333333; /* Keep text color the same */
|
99 |
+
# }
|
100 |
+
|
101 |
+
# /* Active tab styling */
|
102 |
+
# div[data-testid="stTabs"] button[aria-selected="true"] {
|
103 |
+
# background-color: #808080; /* Dark grey for active tab */
|
104 |
+
# color: white; /* White text for active tab */
|
105 |
+
# font-size: 20px; /* Larger font size for active tab */
|
106 |
+
# }
|
107 |
+
# </style>
|
108 |
+
# """,
|
109 |
+
# unsafe_allow_html=True
|
110 |
+
# )
|
111 |
+
|
112 |
+
# #tab1, tab2, tab3 = st.tabs(["Frequently Bought Together Demo", "Co-purchase Count And Confidence", "Historical Order Data"])
|
113 |
+
# tab2, tab3 = st.tabs(["Frequently Bought Together Demo", "Historical Order Data"])
|
114 |
+
|
115 |
+
# with tab2:
|
116 |
+
# if dataset_choice == "Sephora Order Complete Dataset":
|
117 |
+
|
118 |
+
# st.subheader("Recommendations With Co-purchase Count and Confidence")
|
119 |
+
# url2 = "https://gofynd.quip.com/fOONA5yDkSr2/Frequently-Bought-Together-Recommendations"
|
120 |
+
|
121 |
+
# with st.expander("See explanation"):
|
122 |
+
# st.write('''
|
123 |
+
# Co-purchase count refers to the number of times a recommended product has been purchased together with the selected item.
|
124 |
+
# Confidence is the number of times the two products were bought together divided by the number of times the selected product was purchased.
|
125 |
+
# This represents the likelihood that customers who purchased the selected item also purchased the suggested item.
|
126 |
+
# A higher confidence value indicates a stronger relationship between the items. To know more, click [here](%s)"
|
127 |
+
# '''% url2)
|
128 |
+
|
129 |
+
# for rec in recommendation_products_list:
|
130 |
+
# if rec["product_id"] == query_id:
|
131 |
+
# recommendations_found = True
|
132 |
+
# text_rec_list = rec["recommendations"]
|
133 |
+
# if text_rec_list:
|
134 |
+
# text_rec_url = []
|
135 |
+
# text_rec_name = []
|
136 |
+
# for val in text_rec_list:
|
137 |
+
# text_rec_url.append(uid_url_map.get(val["product_id"], ""))
|
138 |
+
# text_rec_name.append(uid_name_map.get(val["product_id"], ""))
|
139 |
+
|
140 |
+
# if query_id in bought_together_dict:
|
141 |
+
# bought_together_items = bought_together_dict[query_id]
|
142 |
+
|
143 |
+
# # Sort the items based on the count in descending order
|
144 |
+
# sorted_items = sorted(bought_together_items.items(), key=lambda x: x[1], reverse=True)
|
145 |
+
|
146 |
+
# # Separate the sorted items into IDs and counts
|
147 |
+
# item_ids = [item[0] for item in sorted_items]
|
148 |
+
# item_counts = [item[1] for item in sorted_items]
|
149 |
+
# confidence_list = []
|
150 |
+
# transactions_with_querry_item = len([transaction for transaction in transactions_list if query_id in transaction])
|
151 |
+
# copurchase_count = []
|
152 |
+
|
153 |
+
# for reccomended_item in item_ids:
|
154 |
+
# transactions_with_item_and_query_item = []
|
155 |
+
# transactions_with_item_and_query_item.extend([transaction for transaction in transactions_list if (reccomended_item in transaction) and (query_id in transaction)])
|
156 |
+
# number_of_transactions_with_reccomended_item_and_query_item = len(transactions_with_item_and_query_item)
|
157 |
+
# copurchase_count.append(number_of_transactions_with_reccomended_item_and_query_item)
|
158 |
+
# confidence_list.append(number_of_transactions_with_reccomended_item_and_query_item/transactions_with_querry_item)
|
159 |
+
|
160 |
+
# # Calculate confidence scores
|
161 |
+
|
162 |
+
# # Retrieve URLs and names based on the sorted item IDs
|
163 |
+
# item_urls = get_mapped_values(item_ids, uid_url_map)
|
164 |
+
# item_names = get_mapped_values(item_ids, uid_name_map)
|
165 |
+
|
166 |
+
# mid_section = ""
|
167 |
+
# for index, value in enumerate(item_urls):
|
168 |
+
# count_info = f"Co-purchased {copurchase_count[index]}/{transactions_with_querry_item} times"
|
169 |
+
# #count_info = f"CP = {copurchase_count[index]}"
|
170 |
+
|
171 |
+
# item_counts_info = f"item-count {item_counts[index]} "
|
172 |
+
# confidence_info = f"Confidence: {round(confidence_list[index], 3)}"
|
173 |
+
|
174 |
+
# # Use <br> to display each line separately
|
175 |
+
# mid_section += f"""<div class="item">
|
176 |
+
# <div id="image-container"><img src='{str(value)}' /></div>
|
177 |
+
# <p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(text_rec_name[index])}</p>
|
178 |
+
# <p>{count_info}<br>{confidence_info}<br></p>
|
179 |
+
# </div>"""
|
180 |
+
|
181 |
+
# mid_html = html + mid_section + """</div></div></body>"""
|
182 |
+
# st.markdown(mid_html, unsafe_allow_html=True)
|
183 |
+
# else:
|
184 |
+
# st.write("No frequent purchases found for this item.")
|
185 |
+
|
186 |
+
# if dataset_choice == "Reliance Digital Order Complete Dataset":
|
187 |
+
# if query_id in corrected_fp_growth_results:
|
188 |
+
|
189 |
+
# # Separate the sorted items into IDs and counts
|
190 |
+
# item_ids = [item for item in corrected_fp_growth_results[query_id]]
|
191 |
+
# item_counts = [corrected_fp_growth_results[query_id][item] for item in corrected_fp_growth_results[query_id]]
|
192 |
+
|
193 |
+
# confidence_list = []
|
194 |
+
# transactions_list_digital = []
|
195 |
+
|
196 |
+
# for i in dictionary_of_transactions:
|
197 |
+
# transactions_list_digital.append(i["transaction"])
|
198 |
+
|
199 |
+
# transactions_with_querry_item = len([transaction for transaction in transactions_list_digital if query_id in transaction])
|
200 |
+
# copurchase_count = []
|
201 |
+
|
202 |
+
# # Generate a list of product names to display
|
203 |
+
# product_names = []
|
204 |
+
# for each_item in corrected_fp_growth_results[query_id]:
|
205 |
+
# product_names.append(all_products_with_names[each_item])
|
206 |
+
|
207 |
+
# for reccomended_item in item_ids:
|
208 |
+
# transactions_with_item_and_query_item = []
|
209 |
+
# transactions_with_item_and_query_item.extend([transaction for transaction in transactions_list_digital if (reccomended_item in transaction) and (query_id in transaction)])
|
210 |
+
# number_of_transactions_with_reccomended_item_and_query_item = len(transactions_with_item_and_query_item)
|
211 |
+
# copurchase_count.append(number_of_transactions_with_reccomended_item_and_query_item)
|
212 |
+
# confidence_list.append(number_of_transactions_with_reccomended_item_and_query_item/transactions_with_querry_item)
|
213 |
+
|
214 |
+
# mid_section = ""
|
215 |
+
# for index, value in enumerate(product_names):
|
216 |
+
# count_info = f"Co-purchased {copurchase_count[index]}/{transactions_with_querry_item} times"
|
217 |
+
# item_counts_info = f"item-count {item_counts[index]} "
|
218 |
+
# confidence_info = f"Confidence: {round(confidence_list[index], 3)}"
|
219 |
+
|
220 |
+
# # Use <br> to display each line separately
|
221 |
+
# mid_section += f"""<div class="item">
|
222 |
+
# <p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(product_names[index])}</p>
|
223 |
+
# <p>{count_info}<br>{confidence_info}<br></p>
|
224 |
+
# </div>"""
|
225 |
+
|
226 |
+
|
227 |
+
# mid_html = html2 + mid_section + """</div></div></body>"""
|
228 |
+
# st.markdown(mid_html, unsafe_allow_html=True)
|
229 |
+
# else:
|
230 |
+
# st.write("No frequent purchases found for this item.")
|
231 |
+
|
232 |
+
# with tab3: #historical transactions tab
|
233 |
+
# if dataset_choice == "Sephora Order Complete Dataset":
|
234 |
+
# st.subheader("Historical Transactions With Chosen Product (shows maximum 20)")
|
235 |
+
# # Filter transactions that contain the selected product
|
236 |
+
# example_transactions = [transaction for transaction in transactions_list if query_id in transaction]
|
237 |
+
|
238 |
+
# # Limit the number of displayed transactions to a maximum of 15
|
239 |
+
# if len(example_transactions) > 15:
|
240 |
+
# example_transactions = example_transactions[:15]
|
241 |
+
|
242 |
+
# if example_transactions:
|
243 |
+
# # Begin constructing the carousel for transactions
|
244 |
+
# for i, transaction in enumerate(example_transactions):
|
245 |
+
# st.markdown(f"**Transaction {i+1}:**", unsafe_allow_html=True)
|
246 |
+
|
247 |
+
# # Retrieve the product names and images for each product in the transaction
|
248 |
+
# transaction_names = get_mapped_values(transaction, uid_name_map)
|
249 |
+
# transaction_images = get_mapped_values(transaction, uid_url_map)
|
250 |
+
|
251 |
+
# # Build the HTML for displaying the transaction in a carousel format
|
252 |
+
# transaction_section = ""
|
253 |
+
# for index, image_url in enumerate(transaction_images):
|
254 |
+
# transaction_section += f"""<div class="item">
|
255 |
+
# <div id="image-container"><img src='{str(image_url)}' /></div>
|
256 |
+
# <p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(transaction_names[index])}</p>
|
257 |
+
# </div>"""
|
258 |
+
|
259 |
+
# # Complete the carousel HTML structure
|
260 |
+
# transaction_html = html + transaction_section + """</div></div></body>"""
|
261 |
+
|
262 |
+
# # Render the carousel for each transaction
|
263 |
+
# st.markdown(transaction_html, unsafe_allow_html=True)
|
264 |
+
|
265 |
+
# else:
|
266 |
+
# st.write("No transactions found for this item.")
|
267 |
+
|
268 |
+
# if dataset_choice == "Reliance Digital Order Complete Dataset":
|
269 |
+
# st.subheader("Historical Transactions With Chosen Product (shows maximum 20)")
|
270 |
+
|
271 |
+
# example_transactions = []
|
272 |
+
# for transaction_dict in dictionary_of_transactions:
|
273 |
+
# if query_id in transaction_dict["transaction"]:
|
274 |
+
# example_transactions.append(transaction_dict)
|
275 |
+
|
276 |
+
# if example_transactions:
|
277 |
+
# # Begin constructing the carousel for transactions
|
278 |
+
# for i, transaction in enumerate(example_transactions):
|
279 |
+
# st.markdown(f"**Transaction {i+1}:** Placed on {transaction['order_date']} by {transaction['customer_id']} from {transaction['delivery_city']}", unsafe_allow_html=True)
|
280 |
+
|
281 |
+
# #Retrieve the product names and images for each product in the transaction
|
282 |
+
# # transaction_names = []
|
283 |
+
# # for i in transaction:
|
284 |
+
# # transaction_names.append(list_of_products_to_display[str(each_item[0])])
|
285 |
+
|
286 |
+
# transaction_names = []
|
287 |
+
# for i in transaction["transaction"]:
|
288 |
+
# transaction_names.append(all_products_with_names[i])
|
289 |
+
|
290 |
+
# # Build the HTML for displaying the transaction in a carousel format
|
291 |
+
# transaction_section = ""
|
292 |
+
# for index, image_url in enumerate(transaction_names):
|
293 |
+
# transaction_section += f"""<div class="item">
|
294 |
+
# <p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(transaction_names[index])}</p>
|
295 |
+
# </div>"""
|
296 |
+
|
297 |
+
# # Complete the carousel HTML structure
|
298 |
+
# transaction_html = html2 + transaction_section + """</div></div></body>"""
|
299 |
+
|
300 |
+
# # Render the carousel for each transaction
|
301 |
+
# st.markdown(transaction_html, unsafe_allow_html=True)
|
302 |
+
|
303 |
+
# else:
|
304 |
+
# st.write("No transactions found for this item.")
|
305 |
+
|
306 |
+
# # Inject custom CSS for the 'Know More' button
|
307 |
+
# st.markdown(
|
308 |
+
# """
|
309 |
+
# <style>
|
310 |
+
# .know-more-button {
|
311 |
+
# background-color: #808080; /* Dark grey background */
|
312 |
+
# color: white !important; /* Force white text color */
|
313 |
+
# font-size: 18px; /* Font size */
|
314 |
+
# font-weight: bold; /* Bold text */
|
315 |
+
# padding: 10px 20px; /* Padding */
|
316 |
+
# border-radius: 10px; /* Rounded corners */
|
317 |
+
# border: none; /* Remove default border */
|
318 |
+
# cursor: pointer; /* Mouse pointer */
|
319 |
+
# text-align: center;
|
320 |
+
# text-decoration: none; /* Remove underline */
|
321 |
+
# display: inline-block; /* Make it inline */
|
322 |
+
# transition: background-color 0.3s ease;
|
323 |
+
# }
|
324 |
+
# .know-more-button:hover {
|
325 |
+
# background-color: #b0b0b0; /* Lighter grey background on hover */
|
326 |
+
# color: #333333 !important; /* Dark grey text on hover */
|
327 |
+
# text-decoration: none; /* Keep underline removed on hover */
|
328 |
+
# }
|
329 |
+
# </style>
|
330 |
+
# """,
|
331 |
+
# unsafe_allow_html=True
|
332 |
+
# )
|
333 |
+
|
334 |
+
# # Add the 'Know More' button with the link and no underline
|
335 |
+
# st.markdown(
|
336 |
+
# '<a href="https://gofynd.quip.com/fOONA5yDkSr2/Frequently-Bought-Together-Recommendations" class="know-more-button">Know More</a>',
|
337 |
+
# unsafe_allow_html=True
|
338 |
+
# )
|
339 |
+
|
340 |
+
|
341 |
+
|
342 |
+
|
343 |
+
import pickle
|
344 |
+
import streamlit as st
|
345 |
+
from html_information import html
|
346 |
+
from html_information2 import html2
|
347 |
+
|
348 |
+
import streamlit as st
|
349 |
+
|
350 |
+
st.set_page_config(page_title="My App", page_icon=":money_with_wings:", layout="wide", initial_sidebar_state="auto")
|
351 |
+
st.header("Frequently Bought Together Recommendations")
|
352 |
+
|
353 |
+
def read_pickle_files(pickle_file):
|
354 |
+
with open(pickle_file, 'rb') as f:
|
355 |
+
return pickle.load(f)
|
356 |
+
|
357 |
+
def get_mapped_values(uid_list, dict_map):
|
358 |
+
res = []
|
359 |
+
for val in uid_list:
|
360 |
+
try:
|
361 |
+
res.append(dict_map[val])
|
362 |
+
except:
|
363 |
+
continue
|
364 |
+
return res
|
365 |
+
|
366 |
+
# Load sephora pickle files
|
367 |
+
# filtered_products_list = read_pickle_files("filtered_products_list.pkl")
|
368 |
+
# recommendation_products_list = read_pickle_files("recommendation_products_list.pkl")
|
369 |
+
# transactions_list = read_pickle_files("transactions.pkl")
|
370 |
+
# bought_together_dict = read_pickle_files("bought_together_dict_orders_data.pkl")
|
371 |
+
# uid_name_map = read_pickle_files("uid_name_map.pkl")
|
372 |
+
# uid_url_map = read_pickle_files("uid_url_map.pkl")
|
373 |
+
|
374 |
+
# Load sephora pickle files
|
375 |
+
corrected_fp_growth_results_sephora = read_pickle_files("sephora_corrected_fp_growth_results_cleaned.pkl")
|
376 |
+
all_products_with_names_sephora = read_pickle_files ("item_catalog.pkl")
|
377 |
+
dictionary_of_transactions_sephora = read_pickle_files("transaction_metadata.pkl")
|
378 |
+
|
379 |
+
# Load digital pickle files
|
380 |
+
corrected_fp_growth_results = read_pickle_files("corrected_fp_growth_results.pkl")
|
381 |
+
all_products_with_names = read_pickle_files ("all_products_with_names.pkl")
|
382 |
+
dictionary_of_transactions = read_pickle_files("reliance_digital_transactions.pkl")
|
383 |
+
|
384 |
+
# Create product dictionary
|
385 |
+
#product_dict = {item['product_id']: item for item in filtered_products_list}
|
386 |
+
|
387 |
+
# Dropdown for selecting the dataset
|
388 |
+
dataset_choice = st.selectbox(
|
389 |
+
"Select A Dataset",
|
390 |
+
["Sephora Order Complete Dataset", "Reliance Digital Order Complete Dataset"]
|
391 |
+
)
|
392 |
+
|
393 |
+
if dataset_choice == "Sephora Order Complete Dataset":
|
394 |
+
list_of_products_to_display = {}
|
395 |
+
for itemid in (list(all_products_with_names_sephora.keys())): #for items in the total list of items in all transactions
|
396 |
+
if itemid in (list(corrected_fp_growth_results_sephora.keys())): #if the item has a result from fp-growth
|
397 |
+
list_of_products_to_display[itemid]= all_products_with_names_sephora[itemid] #show it in the drop down menu
|
398 |
+
|
399 |
+
name_to_id = {name: product_id for product_id, name in list_of_products_to_display.items()} # Reverse the dictionary to map product names to IDs
|
400 |
+
selected_product_name = st.selectbox('Select A Product:', list(name_to_id.keys())) # Create a dropdown menu with the product names
|
401 |
+
|
402 |
+
# Get the corresponding product_id
|
403 |
+
query_id = name_to_id[selected_product_name]
|
404 |
+
url = "https://www.sephora.com/"
|
405 |
+
st.write("Created using the clickstream order-completed and catalog data from [Sephora.com](%s)" % url)
|
406 |
+
|
407 |
+
if dataset_choice == "Reliance Digital Order Complete Dataset":
|
408 |
+
list_of_products_to_display = {}
|
409 |
+
for itemid in (list(all_products_with_names.keys())): #for items in the total list of items in all transactions
|
410 |
+
if itemid in (list(corrected_fp_growth_results.keys())): #if the item has a result from fp-growth
|
411 |
+
list_of_products_to_display[itemid]= all_products_with_names[itemid] #show it in the drop down menu
|
412 |
+
|
413 |
+
name_to_id = {name: product_id for product_id, name in list_of_products_to_display.items()} # Reverse the dictionary to map product names to IDs
|
414 |
+
selected_product_name = st.selectbox('Select A Product:', list(name_to_id.keys())) # Create a dropdown menu with the product names
|
415 |
+
|
416 |
+
# Get the corresponding product_id
|
417 |
+
query_id = name_to_id[selected_product_name]
|
418 |
+
url = "https://www.reliancedigital.in/"
|
419 |
+
st.write("Created using the clickstream order-completed data from [reliancedigital.com](%s)" % url)
|
420 |
+
|
421 |
+
# Inject custom CSS for the tab headings
|
422 |
+
st.markdown(
|
423 |
+
"""
|
424 |
+
<style>
|
425 |
+
/* Style the tab container */
|
426 |
+
div[data-testid="stTabs"] button {
|
427 |
+
background-color: #e0e0e0; /* Light grey background */
|
428 |
+
color: #333333; /* Dark grey text color */
|
429 |
+
font-size: 18px; /* Increase font size */
|
430 |
+
font-weight: bold; /* Make text bold */
|
431 |
+
padding: 10px 20px; /* Add some padding to the tabs */
|
432 |
+
border-radius: 10px; /* Rounded corners */
|
433 |
+
border: none; /* Remove default border */
|
434 |
+
margin: 5px; /* Add margin between tabs */
|
435 |
+
transition: background-color 0.3s ease; /* Add hover effect */
|
436 |
+
}
|
437 |
+
|
438 |
+
/* Hover effect for tabs */
|
439 |
+
div[data-testid="stTabs"] button:hover {
|
440 |
+
background-color: #b0b0b0; /* Darker grey on hover */
|
441 |
+
color: #333333; /* Keep text color the same */
|
442 |
+
}
|
443 |
+
|
444 |
+
/* Active tab styling */
|
445 |
+
div[data-testid="stTabs"] button[aria-selected="true"] {
|
446 |
+
background-color: #808080; /* Dark grey for active tab */
|
447 |
+
color: white; /* White text for active tab */
|
448 |
+
font-size: 20px; /* Larger font size for active tab */
|
449 |
+
}
|
450 |
+
</style>
|
451 |
+
""",
|
452 |
+
unsafe_allow_html=True
|
453 |
+
)
|
454 |
+
|
455 |
+
tab2, tab3 = st.tabs(["Frequently Bought Together Demo", "Historical Order Data"])
|
456 |
+
|
457 |
+
with tab2:
|
458 |
+
if dataset_choice == "Sephora Order Complete Dataset":
|
459 |
+
if query_id in corrected_fp_growth_results_sephora:
|
460 |
+
|
461 |
+
# Separate the sorted items into IDs and counts
|
462 |
+
item_ids = [item for item in corrected_fp_growth_results_sephora[query_id]]
|
463 |
+
item_counts = [corrected_fp_growth_results_sephora[query_id][item] for item in corrected_fp_growth_results_sephora[query_id]]
|
464 |
+
|
465 |
+
confidence_list = []
|
466 |
+
transactions_list_sephora = []
|
467 |
+
|
468 |
+
for i in dictionary_of_transactions_sephora:
|
469 |
+
transactions_list_sephora.append(i["transaction"])
|
470 |
+
|
471 |
+
transactions_with_querry_item = len([transaction for transaction in transactions_list_sephora if int(query_id) in transaction])
|
472 |
+
copurchase_count = []
|
473 |
+
|
474 |
+
# Generate a list of product names to display
|
475 |
+
product_names = []
|
476 |
+
for each_item in corrected_fp_growth_results_sephora[query_id]:
|
477 |
+
product_names.append(all_products_with_names_sephora[each_item])
|
478 |
+
|
479 |
+
for reccomended_item in item_ids:
|
480 |
+
transactions_with_item_and_query_item = []
|
481 |
+
transactions_with_item_and_query_item.extend([transaction for transaction in transactions_list_sephora if (int(reccomended_item) in transaction) and (int(query_id) in transaction)])
|
482 |
+
number_of_transactions_with_reccomended_item_and_query_item = len(transactions_with_item_and_query_item)
|
483 |
+
copurchase_count.append(number_of_transactions_with_reccomended_item_and_query_item)
|
484 |
+
confidence_list.append(number_of_transactions_with_reccomended_item_and_query_item/transactions_with_querry_item)
|
485 |
+
|
486 |
+
mid_section = ""
|
487 |
+
for index, value in enumerate(product_names):
|
488 |
+
count_info = f"Co-purchased {copurchase_count[index]}/{transactions_with_querry_item} times"
|
489 |
+
item_counts_info = f"item-count {item_counts[index]} "
|
490 |
+
confidence_info = f"Confidence: {round(confidence_list[index], 3)}"
|
491 |
+
|
492 |
+
# Use <br> to display each line separately
|
493 |
+
mid_section += f"""<div class="item">
|
494 |
+
<p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(product_names[index])}</p>
|
495 |
+
<p>{count_info}<br>{confidence_info}<br></p>
|
496 |
+
</div>"""
|
497 |
+
|
498 |
+
|
499 |
+
mid_html = html2 + mid_section + """</div></div></body>"""
|
500 |
+
st.markdown(mid_html, unsafe_allow_html=True)
|
501 |
+
else:
|
502 |
+
st.write("No frequent purchases found for this item.")
|
503 |
+
|
504 |
+
if dataset_choice == "Reliance Digital Order Complete Dataset":
|
505 |
+
if query_id in corrected_fp_growth_results:
|
506 |
+
|
507 |
+
# Separate the sorted items into IDs and counts
|
508 |
+
item_ids = [item for item in corrected_fp_growth_results[query_id]]
|
509 |
+
item_counts = [corrected_fp_growth_results[query_id][item] for item in corrected_fp_growth_results[query_id]]
|
510 |
+
|
511 |
+
confidence_list = []
|
512 |
+
transactions_list_digital = []
|
513 |
+
|
514 |
+
for i in dictionary_of_transactions:
|
515 |
+
transactions_list_digital.append(i["transaction"])
|
516 |
+
|
517 |
+
transactions_with_querry_item = len([transaction for transaction in transactions_list_digital if query_id in transaction])
|
518 |
+
copurchase_count = []
|
519 |
+
|
520 |
+
# Generate a list of product names to display
|
521 |
+
product_names = []
|
522 |
+
for each_item in corrected_fp_growth_results[query_id]:
|
523 |
+
product_names.append(all_products_with_names[each_item])
|
524 |
+
|
525 |
+
for reccomended_item in item_ids:
|
526 |
+
transactions_with_item_and_query_item = []
|
527 |
+
transactions_with_item_and_query_item.extend([transaction for transaction in transactions_list_digital if (reccomended_item in transaction) and (query_id in transaction)])
|
528 |
+
number_of_transactions_with_reccomended_item_and_query_item = len(transactions_with_item_and_query_item)
|
529 |
+
copurchase_count.append(number_of_transactions_with_reccomended_item_and_query_item)
|
530 |
+
confidence_list.append(number_of_transactions_with_reccomended_item_and_query_item/transactions_with_querry_item)
|
531 |
+
|
532 |
+
mid_section = ""
|
533 |
+
for index, value in enumerate(product_names):
|
534 |
+
count_info = f"Co-purchased {copurchase_count[index]}/{transactions_with_querry_item} times"
|
535 |
+
item_counts_info = f"item-count {item_counts[index]} "
|
536 |
+
confidence_info = f"Confidence: {round(confidence_list[index], 3)}"
|
537 |
+
|
538 |
+
# Use <br> to display each line separately
|
539 |
+
mid_section += f"""<div class="item">
|
540 |
+
<p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(product_names[index])}</p>
|
541 |
+
<p>{count_info}<br>{confidence_info}<br></p>
|
542 |
+
</div>"""
|
543 |
+
|
544 |
+
|
545 |
+
mid_html = html2 + mid_section + """</div></div></body>"""
|
546 |
+
st.markdown(mid_html, unsafe_allow_html=True)
|
547 |
+
else:
|
548 |
+
st.write("No frequent purchases found for this item.")
|
549 |
+
|
550 |
+
with tab3: #historical transactions tab
|
551 |
+
if dataset_choice == "Sephora Order Complete Dataset":
|
552 |
+
st.subheader("Historical Transactions With Chosen Product (shows maximum 20)")
|
553 |
+
|
554 |
+
example_transactions = []
|
555 |
+
for transaction_dict in dictionary_of_transactions_sephora:
|
556 |
+
if int(query_id) in transaction_dict["transaction"]:
|
557 |
+
example_transactions.append(transaction_dict)
|
558 |
+
|
559 |
+
if example_transactions:
|
560 |
+
# Begin constructing the carousel for transactions
|
561 |
+
for i, transaction in enumerate(example_transactions):
|
562 |
+
st.markdown(f"**Transaction {i+1}:** Placed on {transaction['event_timestamp']} by {transaction['user_id']}", unsafe_allow_html=True)
|
563 |
+
|
564 |
+
#Retrieve the product names and images for each product in the transaction
|
565 |
+
# transaction_names = []
|
566 |
+
# for i in transaction:
|
567 |
+
# transaction_names.append(list_of_products_to_display[str(each_item[0])])
|
568 |
+
|
569 |
+
transaction_names = []
|
570 |
+
for i in transaction["transaction"]:
|
571 |
+
transaction_names.append(all_products_with_names_sephora[str(i)])
|
572 |
+
|
573 |
+
# Build the HTML for displaying the transaction in a carousel format
|
574 |
+
transaction_section = ""
|
575 |
+
for index, image_url in enumerate(transaction_names):
|
576 |
+
transaction_section += f"""<div class="item">
|
577 |
+
<p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(transaction_names[index])}</p>
|
578 |
+
</div>"""
|
579 |
+
|
580 |
+
# Complete the carousel HTML structure
|
581 |
+
transaction_html = html2 + transaction_section + """</div></div></body>"""
|
582 |
+
|
583 |
+
# Render the carousel for each transaction
|
584 |
+
st.markdown(transaction_html, unsafe_allow_html=True)
|
585 |
+
|
586 |
+
else:
|
587 |
+
st.write("No transactions found for this item.")
|
588 |
+
|
589 |
+
|
590 |
+
if dataset_choice == "Reliance Digital Order Complete Dataset":
|
591 |
+
st.subheader("Historical Transactions With Chosen Product (shows maximum 20)")
|
592 |
+
|
593 |
+
example_transactions = []
|
594 |
+
for transaction_dict in dictionary_of_transactions:
|
595 |
+
if query_id in transaction_dict["transaction"]:
|
596 |
+
example_transactions.append(transaction_dict)
|
597 |
+
|
598 |
+
if example_transactions:
|
599 |
+
# Begin constructing the carousel for transactions
|
600 |
+
for i, transaction in enumerate(example_transactions):
|
601 |
+
st.markdown(f"**Transaction {i+1}:** Placed on {transaction['order_date']} by {transaction['customer_id']} from {transaction['delivery_city']}", unsafe_allow_html=True)
|
602 |
+
|
603 |
+
#Retrieve the product names and images for each product in the transaction
|
604 |
+
# transaction_names = []
|
605 |
+
# for i in transaction:
|
606 |
+
# transaction_names.append(list_of_products_to_display[str(each_item[0])])
|
607 |
+
|
608 |
+
transaction_names = []
|
609 |
+
for i in transaction["transaction"]:
|
610 |
+
transaction_names.append(all_products_with_names[i])
|
611 |
+
|
612 |
+
# Build the HTML for displaying the transaction in a carousel format
|
613 |
+
transaction_section = ""
|
614 |
+
for index, image_url in enumerate(transaction_names):
|
615 |
+
transaction_section += f"""<div class="item">
|
616 |
+
<p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(transaction_names[index])}</p>
|
617 |
+
</div>"""
|
618 |
+
|
619 |
+
# Complete the carousel HTML structure
|
620 |
+
transaction_html = html2 + transaction_section + """</div></div></body>"""
|
621 |
+
|
622 |
+
# Render the carousel for each transaction
|
623 |
+
st.markdown(transaction_html, unsafe_allow_html=True)
|
624 |
+
|
625 |
+
else:
|
626 |
+
st.write("No transactions found for this item.")
|
627 |
+
|
628 |
+
|
629 |
+
|
630 |
+
# Inject custom CSS for the 'Know More' button
|
631 |
+
st.markdown(
|
632 |
+
"""
|
633 |
+
<style>
|
634 |
+
.know-more-button {
|
635 |
+
background-color: #808080; /* Dark grey background */
|
636 |
+
color: white !important; /* Force white text color */
|
637 |
+
font-size: 18px; /* Font size */
|
638 |
+
font-weight: bold; /* Bold text */
|
639 |
+
padding: 10px 20px; /* Padding */
|
640 |
+
border-radius: 10px; /* Rounded corners */
|
641 |
+
border: none; /* Remove default border */
|
642 |
+
cursor: pointer; /* Mouse pointer */
|
643 |
+
text-align: center;
|
644 |
+
text-decoration: none; /* Remove underline */
|
645 |
+
display: inline-block; /* Make it inline */
|
646 |
+
transition: background-color 0.3s ease;
|
647 |
+
}
|
648 |
+
.know-more-button:hover {
|
649 |
+
background-color: #b0b0b0; /* Lighter grey background on hover */
|
650 |
+
color: #333333 !important; /* Dark grey text on hover */
|
651 |
+
text-decoration: none; /* Keep underline removed on hover */
|
652 |
+
}
|
653 |
+
</style>
|
654 |
+
""",
|
655 |
+
unsafe_allow_html=True
|
656 |
+
)
|
657 |
+
|
658 |
+
# Add the 'Know More' button with the link and no underline
|
659 |
+
st.markdown(
|
660 |
+
'<a href="https://gofynd.quip.com/fOONA5yDkSr2/Frequently-Bought-Together-Recommendations" class="know-more-button">Know More</a>',
|
661 |
+
unsafe_allow_html=True
|
662 |
+
)
|
corrected_fp_growth_results.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d25f867e2a512c9e71f706e2f5f559476955153705a3f802f265297a64c284d4
|
3 |
+
size 16505
|
html_information.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
html = """
|
2 |
+
<style>
|
3 |
+
body{
|
4 |
+
font-family: sans-serif;
|
5 |
+
}
|
6 |
+
h1{
|
7 |
+
font-weight: 100;
|
8 |
+
}
|
9 |
+
.container{
|
10 |
+
width: 100%;
|
11 |
+
display:block;
|
12 |
+
overflow:hidden;
|
13 |
+
}
|
14 |
+
.carousel{
|
15 |
+
display:block;
|
16 |
+
width: 100%;
|
17 |
+
height: 500px;
|
18 |
+
background: white;
|
19 |
+
padding: 10px;
|
20 |
+
margin: 0;
|
21 |
+
white-space: nowrap;
|
22 |
+
border-top: 2px solid rgba(0, 0, 0, 0);
|
23 |
+
border-bottom: 2px solid rgba(0, 0, 0, 0);
|
24 |
+
}
|
25 |
+
.item {
|
26 |
+
display: inline-block;
|
27 |
+
overflow: hidden;
|
28 |
+
width: 250px;
|
29 |
+
margin: 0 10px;
|
30 |
+
height: calc(100%);
|
31 |
+
background: rgba(0, 0, 0, 0.05) no-repeat center center;
|
32 |
+
background-size: cover;
|
33 |
+
position: relative;
|
34 |
+
border-radius: 20px;
|
35 |
+
box-shadow: 0 0 10px #dfdfdf;
|
36 |
+
}
|
37 |
+
.item p {
|
38 |
+
padding: 10px; /* Reduced padding for less gap */
|
39 |
+
word-wrap: break-word; /* Ensures text breaks at word boundaries */
|
40 |
+
white-space: normal; /* Allows the text to wrap naturally */
|
41 |
+
overflow: hidden;
|
42 |
+
display: -webkit-box;
|
43 |
+
-webkit-line-clamp: 4;
|
44 |
+
-webkit-box-orient: vertical;
|
45 |
+
margin: 0;
|
46 |
+
text-align: center;
|
47 |
+
}
|
48 |
+
#image-container{
|
49 |
+
width: 100%;
|
50 |
+
height: 60%;
|
51 |
+
text-align:center;
|
52 |
+
font-size: 9em;
|
53 |
+
color: white;
|
54 |
+
overflow: hidden;
|
55 |
+
border-radius: 20px; /* Rounding the image corners */
|
56 |
+
}
|
57 |
+
#image-container img{
|
58 |
+
width: 90%;
|
59 |
+
height: 90%;
|
60 |
+
object-fit: contain;
|
61 |
+
border-radius: 20px; /* Ensures images are also rounded */
|
62 |
+
margin-bottom: 10px; /* Reduce margin for less space between image and text */
|
63 |
+
}
|
64 |
+
|
65 |
+
</style>
|
66 |
+
</head>
|
67 |
+
<body>
|
68 |
+
<div class="container">
|
69 |
+
<div class="carousel">
|
70 |
+
|
71 |
+
|
72 |
+
"""
|
html_information2.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
html2 = """
|
2 |
+
<style>
|
3 |
+
body{
|
4 |
+
font-family: sans-serif;
|
5 |
+
}
|
6 |
+
h1{
|
7 |
+
font-weight: 100;
|
8 |
+
}
|
9 |
+
.container{
|
10 |
+
width: 100%;
|
11 |
+
display:block;
|
12 |
+
overflow:hidden;
|
13 |
+
}
|
14 |
+
.carousel{
|
15 |
+
display:block;
|
16 |
+
width: 100%;
|
17 |
+
height: 275px;
|
18 |
+
background: white;
|
19 |
+
padding: 10px;
|
20 |
+
margin: 0;
|
21 |
+
white-space: nowrap;
|
22 |
+
border-top: 2px solid rgba(0, 0, 0, 0);
|
23 |
+
border-bottom: 2px solid rgba(0, 0, 0, 0);
|
24 |
+
}
|
25 |
+
.item {
|
26 |
+
display: inline-block;
|
27 |
+
overflow: hidden;
|
28 |
+
width: 250px;
|
29 |
+
margin: 0 10px;
|
30 |
+
height: calc(100%);
|
31 |
+
background: rgba(0, 0, 0, 0.05) no-repeat center center;
|
32 |
+
background-size: cover;
|
33 |
+
position: relative;
|
34 |
+
border-radius: 20px;
|
35 |
+
box-shadow: 0 0 10px #dfdfdf;
|
36 |
+
}
|
37 |
+
.item p {
|
38 |
+
padding: 10px; /* Reduced padding for less gap */
|
39 |
+
word-wrap: break-word; /* Ensures text breaks at word boundaries */
|
40 |
+
white-space: normal; /* Allows the text to wrap naturally */
|
41 |
+
overflow: hidden;
|
42 |
+
display: -webkit-box;
|
43 |
+
-webkit-line-clamp: 6;
|
44 |
+
-webkit-box-orient: vertical;
|
45 |
+
margin: 0;
|
46 |
+
text-align: center;
|
47 |
+
}
|
48 |
+
#image-container{
|
49 |
+
width: 100%;
|
50 |
+
height: 60%;
|
51 |
+
text-align:center;
|
52 |
+
font-size: 9em;
|
53 |
+
color: white;
|
54 |
+
overflow: hidden;
|
55 |
+
border-radius: 20px; /* Rounding the image corners */
|
56 |
+
}
|
57 |
+
#image-container img{
|
58 |
+
width: 90%;
|
59 |
+
height: 90%;
|
60 |
+
object-fit: contain;
|
61 |
+
border-radius: 20px; /* Ensures images are also rounded */
|
62 |
+
margin-bottom: 10px; /* Reduce margin for less space between image and text */
|
63 |
+
}
|
64 |
+
|
65 |
+
</style>
|
66 |
+
</head>
|
67 |
+
<body>
|
68 |
+
<div class="container">
|
69 |
+
<div class="carousel">
|
70 |
+
|
71 |
+
|
72 |
+
"""
|
item_catalog.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9239264b7b79762444bc610e837387ced0c58badeed884d79097d7218389a548
|
3 |
+
size 299750
|
reliance_digital_transactions.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9527e5732b2f0364917e54a898e888253dcac64981c384e75ba3f7bb5f6aebbc
|
3 |
+
size 1182171
|
sephora_corrected_fp_growth_results_cleaned.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:23263bc088274792f67a2a7e10e58da7fd5c232a09ec9ad48b2179cc0808ea20
|
3 |
+
size 74882
|
transaction_metadata.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:86bb8992712dedeb054fcf12b7d311d37dba3c182eaa7a85781c5d99ee83e157
|
3 |
+
size 1912314
|