Spaces:
Running
on
T4
Running
on
T4
import streamlit as st | |
from PIL import Image | |
import base64 | |
import yaml | |
import os | |
import urllib.request | |
import tarfile | |
import subprocess | |
from yaml.loader import SafeLoader | |
st.set_page_config( | |
layout="wide", | |
page_icon="/home/ubuntu/images/opensearch_mark_default.png" | |
) | |
st.markdown("""<style> | |
@import url('https://fonts.cdnfonts.com/css/amazon-ember'); | |
</style> | |
""",unsafe_allow_html=True) | |
AI_ICON = "images/opensearch-twitter-card.png" | |
col_0_1,col_0_2,col_0_3= st.columns([10,50,85]) | |
with col_0_1: | |
st.image(AI_ICON, use_column_width='always') | |
with col_0_2: | |
st.markdown('<p style="fontSize:40px;color:#FF9900;fontFamily:\'Amazon Ember Display 500\', sans-serif;">OpenSearch AI demos</p>',unsafe_allow_html=True) | |
#st.header(":rewind: Demos available") | |
st.write("") | |
st.write("") | |
col_1_1,col_1_2,col_1_3 = st.columns([3,40,65]) | |
with col_1_1: | |
st.subheader(" ") | |
with col_1_2: | |
st.markdown('<p style="fontSize:28px;color:#c5c3c0;fontFamily:\'Amazon Ember Cd RC 250\', sans-serif;">Neural Search</p>',unsafe_allow_html=True) | |
with col_1_3: | |
demo_1 = st.button("Launch",key = "demo_1") | |
if(demo_1): | |
st.switch_page('pages/Semantic_Search.py') | |
st.write("") | |
col_2_1,col_2_2,col_2_3 = st.columns([3,40,65]) | |
with col_2_1: | |
st.subheader(" ") | |
with col_2_2: | |
st.markdown('<p style="fontSize:28px;color:#c5c3c0;fontFamily:\'Amazon Ember Cd RC 250\', sans-serif;">Multimodal Conversational Search</p>',unsafe_allow_html=True) | |
with col_2_3: | |
demo_2 = st.button("Launch",key = "demo_2") | |
if(demo_2): | |
st.switch_page('pages/Multimodal_Conversational_Search.py') | |
st.write("") | |
col_3_1,col_3_2,col_3_3 = st.columns([3,40,65]) | |
with col_3_1: | |
st.subheader(" ") | |
with col_3_2: | |
st.markdown('<div style="fontSize:28px;color:#c5c3c0;fontFamily:\'Amazon Ember Cd RC 250\', sans-serif;">Agentic Shopping Assistant</div>',unsafe_allow_html=True)#<span style="fontSize:14px;color:#099ef3;fontWeight:bold;textDecorationLine:underline;textDecorationStyle: dashed;">New</span> | |
with col_3_3: | |
demo_3 = st.button("Launch",key = "demo_3") | |
if(demo_3): | |
st.switch_page('pages/AI_Shopping_Assistant.py') | |
isExist = os.path.exists("/home/user/images_retail") | |
if not isExist: | |
os.makedirs("/home/user/images_retail") | |
metadata_file = urllib.request.urlretrieve('https://aws-blogs-artifacts-public.s3.amazonaws.com/BDB-3144/products-data.yml', '/home/user/products.yaml') | |
img_filename,headers= urllib.request.urlretrieve('https://aws-blogs-artifacts-public.s3.amazonaws.com/BDB-3144/images.tar.gz', '/home/user/images_retail/images.tar.gz') | |
print(img_filename) | |
file = tarfile.open('/home/user/images_retail/images.tar.gz') | |
file.extractall('/home/user/images_retail/') | |
file.close() | |
#remove images.tar.gz | |
os.remove('/home/user/images_retail/images.tar.gz') |