Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
app look
Browse files
app.py
CHANGED
|
@@ -5,74 +5,110 @@ import yaml
|
|
| 5 |
import os
|
| 6 |
import urllib.request
|
| 7 |
import tarfile
|
| 8 |
-
import subprocess
|
| 9 |
from yaml.loader import SafeLoader
|
| 10 |
|
| 11 |
-
|
| 12 |
st.set_page_config(
|
| 13 |
layout="wide",
|
| 14 |
page_icon="/home/ubuntu/images/opensearch_mark_default.png"
|
| 15 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
st.markdown("""
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
st.markdown('<p style="fontSize:40px;color:#FF9900;fontFamily:\'Amazon Ember Display 500\', sans-serif;">OpenSearch AI demos</p>',unsafe_allow_html=True)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
st.markdown('<p style="fontSize:28px;color:#c5c3c0;fontFamily:\'Amazon Ember Cd RC 250\', sans-serif;">Neural Search</p>',unsafe_allow_html=True)
|
| 39 |
-
with col_1_3:
|
| 40 |
-
demo_1 = st.button("Launch",key = "demo_1")
|
| 41 |
-
if(demo_1):
|
| 42 |
-
st.switch_page('pages/Semantic_Search.py')
|
| 43 |
-
st.write("")
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
st.write("")
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
-
col_3_1,col_3_2,col_3_3 = st.columns([3,40,65])
|
| 59 |
-
with col_3_1:
|
| 60 |
-
st.subheader(" ")
|
| 61 |
-
with col_3_2:
|
| 62 |
-
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>
|
| 63 |
-
with col_3_3:
|
| 64 |
-
demo_3 = st.button("Launch",key = "demo_3")
|
| 65 |
-
if(demo_3):
|
| 66 |
-
st.switch_page('pages/AI_Shopping_Assistant.py')
|
| 67 |
-
|
| 68 |
-
isExist = os.path.exists("/home/user/images_retail")
|
| 69 |
-
if not isExist:
|
| 70 |
-
os.makedirs("/home/user/images_retail")
|
| 71 |
-
metadata_file = urllib.request.urlretrieve('https://aws-blogs-artifacts-public.s3.amazonaws.com/BDB-3144/products-data.yml', '/home/user/products.yaml')
|
| 72 |
-
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')
|
| 73 |
-
print(img_filename)
|
| 74 |
-
file = tarfile.open('/home/user/images_retail/images.tar.gz')
|
| 75 |
-
file.extractall('/home/user/images_retail/')
|
| 76 |
-
file.close()
|
| 77 |
-
#remove images.tar.gz
|
| 78 |
-
os.remove('/home/user/images_retail/images.tar.gz')
|
|
|
|
| 5 |
import os
|
| 6 |
import urllib.request
|
| 7 |
import tarfile
|
|
|
|
| 8 |
from yaml.loader import SafeLoader
|
| 9 |
|
| 10 |
+
# Page setup
|
| 11 |
st.set_page_config(
|
| 12 |
layout="wide",
|
| 13 |
page_icon="/home/ubuntu/images/opensearch_mark_default.png"
|
| 14 |
)
|
| 15 |
+
st.markdown("""
|
| 16 |
+
<style>
|
| 17 |
+
html, body, .main {
|
| 18 |
+
overflow: hidden;
|
| 19 |
+
height: 100vh;
|
| 20 |
+
}
|
| 21 |
+
</style>
|
| 22 |
+
""", unsafe_allow_html=True)
|
| 23 |
|
| 24 |
+
st.markdown("""
|
| 25 |
+
<style>
|
| 26 |
+
body {
|
| 27 |
+
background-color: #1E1E1E;
|
| 28 |
+
color: #FFFFFF;
|
| 29 |
+
}
|
| 30 |
+
.main {
|
| 31 |
+
background-color: #1E1E1E !important;
|
| 32 |
+
}
|
| 33 |
+
</style>
|
| 34 |
+
""", unsafe_allow_html=True)
|
| 35 |
+
# Font
|
| 36 |
+
st.markdown("""
|
| 37 |
+
<style>
|
| 38 |
+
@import url('https://fonts.cdnfonts.com/css/amazon-ember');
|
| 39 |
|
| 40 |
+
body {
|
| 41 |
+
background-color: #000000;
|
| 42 |
+
color: #FFFFFF;
|
| 43 |
+
font-family: 'Amazon Ember', sans-serif;
|
| 44 |
+
}
|
|
|
|
| 45 |
|
| 46 |
+
.title {
|
| 47 |
+
font-size: 40px;
|
| 48 |
+
color: #FF9900;
|
| 49 |
+
font-family: 'Amazon Ember Display 500', sans-serif;
|
| 50 |
+
margin-bottom: 10px;
|
| 51 |
+
}
|
| 52 |
|
| 53 |
+
.demo-card {
|
| 54 |
+
background-color: #111111;
|
| 55 |
+
border-radius: 12px;
|
| 56 |
+
padding: 20px;
|
| 57 |
+
margin: 10px 0;
|
| 58 |
+
display: flex;
|
| 59 |
+
justify-content: space-between;
|
| 60 |
+
align-items: center;
|
| 61 |
+
border: 1px solid #333333;
|
| 62 |
+
}
|
| 63 |
|
| 64 |
+
.demo-text {
|
| 65 |
+
font-size: 24px;
|
| 66 |
+
color: #c5c3c0;
|
| 67 |
+
font-family: 'Amazon Ember Cd RC 250', sans-serif;
|
| 68 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
.demo-button {
|
| 71 |
+
background-color: #000000;
|
| 72 |
+
border: 1px solid #888;
|
| 73 |
+
color: white;
|
| 74 |
+
padding: 8px 18px;
|
| 75 |
+
border-radius: 6px;
|
| 76 |
+
font-size: 16px;
|
| 77 |
+
}
|
| 78 |
|
| 79 |
+
a .demo-card:hover {
|
| 80 |
+
background-color: #FF9900 !important;
|
| 81 |
+
color: black !important;
|
| 82 |
+
transition: 0.3s;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
</style>
|
| 86 |
+
""", unsafe_allow_html=True)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
# Header with logo and title
|
| 91 |
+
extra, col_logo, col_title = st.columns([3,40, 58])
|
| 92 |
+
with col_logo:
|
| 93 |
+
st.image("/home/user/app/images/OS_AI_1_cropped.png", use_column_width=True)
|
| 94 |
+
|
| 95 |
+
#st.image("/home/ubuntu/images/OS_AI_1.png", use_column_width=True)
|
| 96 |
+
# with col_title:
|
| 97 |
+
# st.write("")
|
| 98 |
+
# st.markdown('<div class="title">OpenSearch AI demos</div>', unsafe_allow_html=True)
|
| 99 |
+
|
| 100 |
+
def demo_link_block(icon, title, target_page):
|
| 101 |
+
st.markdown(f"""
|
| 102 |
+
<a href="/{target_page}" target="_self" style="text-decoration: none;">
|
| 103 |
+
<div class="demo-card">
|
| 104 |
+
<div class="demo-text">{icon} {title}</div>
|
| 105 |
+
</div>
|
| 106 |
+
</a>
|
| 107 |
+
""", unsafe_allow_html=True)
|
| 108 |
+
|
| 109 |
st.write("")
|
| 110 |
+
demo_link_block("🔍", "AI Search", "Semantic_Search")
|
| 111 |
+
demo_link_block("💬","Multimodal Conversational Search", "Multimodal_Conversational_Search")
|
| 112 |
+
demo_link_block("🛍️","Agentic Shopping Assistant", "AI_Shopping_Assistant")
|
| 113 |
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|