prasadnu commited on
Commit
9270b74
·
1 Parent(s): e280474
Files changed (1) hide show
  1. app.py +91 -55
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("""<style>
18
- @import url('https://fonts.cdnfonts.com/css/amazon-ember');
19
- </style>
20
- """,unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- AI_ICON = "images/opensearch-twitter-card.png"
23
- col_0_1,col_0_2,col_0_3= st.columns([10,50,85])
24
- with col_0_1:
25
- st.image(AI_ICON, use_column_width='always')
26
- with col_0_2:
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
- #st.header(":rewind: Demos available")
31
- st.write("")
 
 
 
 
 
 
 
 
32
 
33
- st.write("")
34
- col_1_1,col_1_2,col_1_3 = st.columns([3,40,65])
35
- with col_1_1:
36
- st.subheader(" ")
37
- with col_1_2:
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
- col_2_1,col_2_2,col_2_3 = st.columns([3,40,65])
46
- with col_2_1:
47
- st.subheader(" ")
48
- with col_2_2:
49
- st.markdown('<p style="fontSize:28px;color:#c5c3c0;fontFamily:\'Amazon Ember Cd RC 250\', sans-serif;">Multimodal Conversational Search</p>',unsafe_allow_html=True)
 
 
 
50
 
51
- with col_2_3:
52
- demo_2 = st.button("Launch",key = "demo_2")
53
- if(demo_2):
54
- st.switch_page('pages/Multimodal_Conversational_Search.py')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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