Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
added dataset
Browse files- pages/Semantic_Search.py +3 -0
- pages/dataset.py +48 -0
pages/Semantic_Search.py
CHANGED
|
@@ -637,6 +637,9 @@ with col4:
|
|
| 637 |
if(search_all_type == True or 1==1):
|
| 638 |
with st.sidebar:
|
| 639 |
st.page_link("app.py", label=":orange[Home]", icon="๐ ")
|
|
|
|
|
|
|
|
|
|
| 640 |
|
| 641 |
|
| 642 |
########################## enable for query_rewrite ########################
|
|
|
|
| 637 |
if(search_all_type == True or 1==1):
|
| 638 |
with st.sidebar:
|
| 639 |
st.page_link("app.py", label=":orange[Home]", icon="๐ ")
|
| 640 |
+
st.page_link("dataset.py", label=":orange[Preview Product catalog]")
|
| 641 |
+
|
| 642 |
+
|
| 643 |
|
| 644 |
|
| 645 |
########################## enable for query_rewrite ########################
|
pages/dataset.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import boto3
|
| 3 |
+
import requests
|
| 4 |
+
import json
|
| 5 |
+
import time
|
| 6 |
+
import os
|
| 7 |
+
from ruamel.yaml import YAML
|
| 8 |
+
import sys
|
| 9 |
+
preview_data = ["footwear","jewelry","apparel","beauty","housewares"]
|
| 10 |
+
yaml = YAML()
|
| 11 |
+
preview_contain = st.container()
|
| 12 |
+
preview_items = yaml.load(open('/data/app_bkp/images_retail/preview_data.yaml'))
|
| 13 |
+
|
| 14 |
+
with st.expander("Preview retail data samples",expanded = True):
|
| 15 |
+
samp1, samp2,samp3,samp4 = st.columns([25,25,25,25])
|
| 16 |
+
col_array = [samp1, samp2,samp3,samp4]
|
| 17 |
+
count = 0
|
| 18 |
+
for item in preview_items:
|
| 19 |
+
|
| 20 |
+
count = count + 1
|
| 21 |
+
fileshort = "/data/app_bkp/images_retail/"+item["category"]+"/"+item["image"]
|
| 22 |
+
|
| 23 |
+
payload = {}
|
| 24 |
+
payload['product_description'] = item['description']
|
| 25 |
+
payload['caption'] = item['name']
|
| 26 |
+
payload['category'] = item['category']
|
| 27 |
+
payload['price'] = item['price']
|
| 28 |
+
if('gender_affinity' in item):
|
| 29 |
+
if(item['gender_affinity'] == 'M'):
|
| 30 |
+
payload['gender_affinity'] = 'Male'
|
| 31 |
+
else:
|
| 32 |
+
if(item['gender_affinity'] == 'F'):
|
| 33 |
+
payload['gender_affinity'] = 'Female'
|
| 34 |
+
else:
|
| 35 |
+
payload['gender_affinity'] = item['gender_affinity']
|
| 36 |
+
if('style' in item):
|
| 37 |
+
payload['style'] = item['style']
|
| 38 |
+
with col_array[count-1]:
|
| 39 |
+
if(count == 1):
|
| 40 |
+
st.subheader(item['category'])
|
| 41 |
+
else:
|
| 42 |
+
st.subheader("")
|
| 43 |
+
|
| 44 |
+
st.image(fileshort,use_column_width="always")
|
| 45 |
+
st.write(":orange["+payload['caption']+"]")
|
| 46 |
+
st.json(payload,expanded = True)
|
| 47 |
+
if(count == 4):
|
| 48 |
+
count = 0
|