Spaces:
Runtime error
Runtime error
Commit
·
94f6f46
1
Parent(s):
79a057a
Add new pkl files and corresponding app changes
Browse files- app.py +28 -44
- color_global_local_filters.pkl +3 -0
- color_no_filters.pkl +3 -0
- no_color_global_local_filters.pkl +3 -0
- no_color_no_filters.pkl +3 -0
- no_color_no_filters_attributes_rank_1.pkl +3 -0
- no_color_no_filters_brand_rank_1.pkl +3 -0
app.py
CHANGED
|
@@ -26,12 +26,31 @@ def get_mapped_values(uid_list, uid_map_dict):
|
|
| 26 |
return res
|
| 27 |
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
uid_name_map = load_pickle_file('generalize_uid_name_map.pkl')
|
| 30 |
uid_media_map = load_pickle_file('generalize_uid_media_map.pkl')
|
| 31 |
-
bt_no_color_rec = load_pickle_file('bt_no_color.pkl')
|
| 32 |
-
bt_color_rec = load_pickle_file('bt_color.pkl')
|
| 33 |
-
bt_color_no_cat_order = load_pickle_file('bt_color_no_cat_order.pkl')
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
st.set_page_config(page_title="My App", page_icon=":guardsman:", layout="wide", initial_sidebar_state="auto")
|
|
@@ -45,47 +64,12 @@ print(query_id)
|
|
| 45 |
print()
|
| 46 |
query_url = uid_media_map[query_id]
|
| 47 |
st.image(query_url, width=200)
|
| 48 |
-
for
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
text_rec_name = []
|
| 55 |
-
for val in text_rec_list:
|
| 56 |
-
text_rec_url.append(uid_media_map[val["product_id"]])
|
| 57 |
-
text_rec_name.append(uid_name_map[val["product_id"]])
|
| 58 |
-
streamlit_carousel("BT Recommendations No Color", text_rec_url, text_rec_name)
|
| 59 |
-
else:
|
| 60 |
-
st.write("No BT recommendations found")
|
| 61 |
-
|
| 62 |
-
for val in bt_color_rec:
|
| 63 |
-
if val["product_id"] == query_id:
|
| 64 |
-
text_rec_list = val["recommendations"]
|
| 65 |
-
print(text_rec_list)
|
| 66 |
-
if text_rec_list:
|
| 67 |
-
text_rec_url = []
|
| 68 |
-
text_rec_name = []
|
| 69 |
-
for val in text_rec_list:
|
| 70 |
-
text_rec_url.append(uid_media_map[val["product_id"]])
|
| 71 |
-
text_rec_name.append(uid_name_map[val["product_id"]])
|
| 72 |
-
streamlit_carousel("BT Recommendations Color", text_rec_url, text_rec_name)
|
| 73 |
-
else:
|
| 74 |
-
st.write("No BT recommendations found")
|
| 75 |
-
|
| 76 |
-
for val in bt_color_no_cat_order:
|
| 77 |
-
if val["product_id"] == query_id:
|
| 78 |
-
text_rec_list = val["recommendations"]
|
| 79 |
-
print(text_rec_list)
|
| 80 |
-
if text_rec_list:
|
| 81 |
-
text_rec_url = []
|
| 82 |
-
text_rec_name = []
|
| 83 |
-
for val in text_rec_list:
|
| 84 |
-
text_rec_url.append(uid_media_map[val["product_id"]])
|
| 85 |
-
text_rec_name.append(uid_name_map[val["product_id"]])
|
| 86 |
-
streamlit_carousel("BT Recommendations Color No Category Order", text_rec_url, text_rec_name)
|
| 87 |
-
else:
|
| 88 |
-
st.write("No BT recommendations found No Category Order")
|
| 89 |
|
| 90 |
|
| 91 |
|
|
|
|
| 26 |
return res
|
| 27 |
|
| 28 |
|
| 29 |
+
def carousel_wrapper(rec_list, query_id, uid_media_map, uid_name_map, header_name, exception_header_name):
|
| 30 |
+
for val in rec_list:
|
| 31 |
+
if val["product_id"] == query_id:
|
| 32 |
+
text_rec_list = val["recommendations"]
|
| 33 |
+
print(text_rec_list)
|
| 34 |
+
if text_rec_list:
|
| 35 |
+
text_rec_url = []
|
| 36 |
+
text_rec_name = []
|
| 37 |
+
for val in text_rec_list:
|
| 38 |
+
text_rec_url.append(uid_media_map[val["product_id"]])
|
| 39 |
+
text_rec_name.append(uid_name_map[val["product_id"]])
|
| 40 |
+
streamlit_carousel(header_name, text_rec_url, text_rec_name)
|
| 41 |
+
else:
|
| 42 |
+
st.write(exception_header_name)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
uid_name_map = load_pickle_file('generalize_uid_name_map.pkl')
|
| 46 |
uid_media_map = load_pickle_file('generalize_uid_media_map.pkl')
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
color_global_local_filters_rec = load_pickle_file('color_global_local_filters.pkl')
|
| 49 |
+
color_no_filters_rec = load_pickle_file('color_no_filters.pkl')
|
| 50 |
+
no_color_global_local_filters_rec = load_pickle_file('no_color_global_local_filters.pkl')
|
| 51 |
+
no_color_no_filters_rec = load_pickle_file('no_color_no_filters.pkl')
|
| 52 |
+
no_color_no_filters_attributes_rank_1_rec = load_pickle_file('no_color_no_filters_attributes_rank_1.pkl')
|
| 53 |
+
no_color_no_filters_brand_rank_1_rec = load_pickle_file('no_color_no_filters_brand_rank_1.pkl')
|
| 54 |
|
| 55 |
|
| 56 |
st.set_page_config(page_title="My App", page_icon=":guardsman:", layout="wide", initial_sidebar_state="auto")
|
|
|
|
| 64 |
print()
|
| 65 |
query_url = uid_media_map[query_id]
|
| 66 |
st.image(query_url, width=200)
|
| 67 |
+
carousel_wrapper(color_global_local_filters_rec, query_id, uid_media_map, uid_name_map, "Color Global Filter: 'Jeans', Local Filter: No 'Trousers' for 'Formal Shirts'", "No BT recommendations found")
|
| 68 |
+
carousel_wrapper(no_color_global_local_filters_rec, query_id, uid_media_map, uid_name_map, "No Color Global Filter: 'Jeans', Local Filter: No 'Trousers' for 'Formal Shirts'", "No BT recommendations found")
|
| 69 |
+
carousel_wrapper(color_no_filters_rec, query_id, uid_media_map, uid_name_map, "Color No Filters", "No BT recommendations found")
|
| 70 |
+
carousel_wrapper(no_color_no_filters_rec, query_id, uid_media_map, uid_name_map, "No Color No Filters", "No BT recommendations found")
|
| 71 |
+
carousel_wrapper(no_color_no_filters_attributes_rank_1_rec, query_id, uid_media_map, uid_name_map, "No Color No Filters Attributes Name Rank 1", "No BT recommendations found")
|
| 72 |
+
carousel_wrapper(no_color_no_filters_brand_rank_1_rec, query_id, uid_media_map, uid_name_map, "No Color No Filters Brand Name Rank 1", "No BT recommendations found")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
|
| 75 |
|
color_global_local_filters.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa511007c8c13503b8b2ebf59cb93d8219a96a11a0aea2bb6d910e1ee1141aea
|
| 3 |
+
size 33035185
|
color_no_filters.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04ae7370d48942660bd6e8126b7b38a53e26031ee9ffe140e26479ff426c8ef3
|
| 3 |
+
size 35003646
|
no_color_global_local_filters.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07a116fcb71d6a0272025024fd7ae59ca1d08b130d12248ebbcd6613dc7f89ad
|
| 3 |
+
size 33249363
|
no_color_no_filters.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:429d605d39457fd96a593ed451bb392634315c41e0d400d6cf0e43ea12bfef7a
|
| 3 |
+
size 34471888
|
no_color_no_filters_attributes_rank_1.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14c168697c290a1c55bc14d804b9aa68b1322014c134e420a03cbec62f17e13f
|
| 3 |
+
size 34361860
|
no_color_no_filters_brand_rank_1.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:df6f68aa527555f74f0b4400333a5c94c28d6497b555f9984dadb330db04cfa4
|
| 3 |
+
size 35032182
|