gvlktejaswi commited on
Commit
2c6fcab
·
verified ·
1 Parent(s): 7c6c514

Update page_files/Home.py

Browse files
Files changed (1) hide show
  1. page_files/Home.py +12 -29
page_files/Home.py CHANGED
@@ -79,24 +79,17 @@ st.markdown("""
79
  st.markdown("""
80
  <style>
81
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap');
82
-
83
  /* Hide default Streamlit chrome */
84
  .block-container { padding: 0 !important; max-width: 100% !important; background: #fff !important;}
85
  [data-testid="stToolbar"],
86
  [data-testid="stDecoration"],
87
  [data-testid="stHeader"] { display: none !important; }
88
-
89
-
90
-
91
-
92
-
93
  /* ── Search row ── */
94
  /* Only target the search bar's horizontal block, not all columns */
95
  .st-emotion-cache-y1l7l5 .st-emotion-cache-1permvm {
96
  gap: 0 !important;
97
  align-items: stretch !important;
98
  }
99
-
100
  .st-emotion-cache-16s2yzk button {
101
  background: #f2f6f4 !important;
102
  border: 1.5px solid #d0d8d4 !important;
@@ -111,7 +104,6 @@ st.markdown("""
111
  white-space: nowrap !important;
112
  box-shadow: none !important;
113
  }
114
-
115
  .st-emotion-cache-4dubyl [data-baseweb="input"] {
116
  background: #000 !important;
117
  height: 46px !important;
@@ -133,9 +125,7 @@ st.markdown("""
133
  box-shadow: none !important;
134
  padding-left: 18px !important;
135
  }
136
-
137
  .st-emotion-cache-4dubyl > div {
138
-
139
  height: 46px !important;
140
  }
141
  .st-emotion-cache-4dubyl input::placeholder {
@@ -155,7 +145,6 @@ st.markdown("""
155
  padding: 0 28px !important;
156
  box-shadow: none !important;
157
  }
158
-
159
  .st-key-view_all_btn button {
160
  background: transparent !important;
161
  border: none !important;
@@ -183,12 +172,20 @@ st.markdown("""
183
  margin-bottom: 14px;
184
  font-family: 'DM Sans', sans-serif;
185
  }
186
-
187
  </style>
188
  """, unsafe_allow_html=True)
189
 
190
 
191
 
 
 
 
 
 
 
 
 
 
192
  # PostMessage listener for iframe card clicks
193
  components.html("""
194
  <script>
@@ -251,7 +248,6 @@ components.html(f"""
251
  <style>
252
  *, *::before, *::after {{ box-sizing: border-box; margin: 0; padding: 0; }}
253
  body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26; overflow-x: hidden; }}
254
-
255
  /* ANIMATION SECTION */
256
  .anim-section {{
257
  background: #000;
@@ -267,7 +263,6 @@ body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26;
267
  display: flex; align-items: center;
268
  justify-content: space-between; padding: 0 40px;
269
  }}
270
-
271
  /* MAG GLASS */
272
  .mag-wrap {{ position: relative; width: 100px; display: flex; flex-direction: column; align-items: center; }}
273
  .mag-label {{ font-size: 0.65rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #4a7a6a; margin-bottom: 10px; }}
@@ -278,7 +273,6 @@ body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26;
278
  .mag-scan {{ opacity: 0; transition: opacity 0.3s ease 0.8s; }}
279
  .mag-wrap.active .mag-scan {{ opacity: 1; animation: scanMove 1.2s ease-in-out infinite 0.8s; }}
280
  @keyframes scanMove {{ 0% {{ transform:translateY(-14px);opacity:.8; }} 50% {{ transform:translateY(0);opacity:1; }} 100% {{ transform:translateY(14px);opacity:.8; }} }}
281
-
282
  /* BUBBLES */
283
  .bubble {{ position:absolute; border-radius:50%; background:radial-gradient(circle at 35% 35%,rgba(255,255,255,.6),rgba(80,160,255,.25)); border:1px solid rgba(100,180,255,.4); opacity:0; pointer-events:none; backdrop-filter:blur(2px); }}
284
  .b1 {{ width:18px;height:18px;left:108px;bottom:155px; }}
@@ -299,7 +293,6 @@ body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26;
299
  @keyframes floatBubble4 {{ 0% {{ opacity:0;transform:translate(0,0) scale(.3); }} 20% {{ opacity:1;transform:translate(-8px,-35px) scale(1); }} 65% {{ opacity:.8;transform:translate(105px,-80px) scale(.8); }} 88% {{ opacity:.3;transform:translate(255px,-50px) scale(.4); }} 100% {{ opacity:0;transform:translate(320px,-20px) scale(.1); }} }}
300
  @keyframes floatBubble5 {{ 0% {{ opacity:0;transform:translate(0,0) scale(.4); }} 15% {{ opacity:1;transform:translate(3px,-22px) scale(1); }} 58% {{ opacity:.9;transform:translate(115px,-60px) scale(.88); }} 83% {{ opacity:.45;transform:translate(270px,-35px) scale(.55); }} 100% {{ opacity:0;transform:translate(335px,-12px) scale(.2); }} }}
301
  @keyframes floatBubble6 {{ 0% {{ opacity:0;transform:translate(0,0) scale(.25); }} 20% {{ opacity:1;transform:translate(-3px,-40px) scale(1); }} 62% {{ opacity:.7;transform:translate(100px,-85px) scale(.75); }} 85% {{ opacity:.25;transform:translate(250px,-55px) scale(.35); }} 100% {{ opacity:0;transform:translate(318px,-22px) scale(.1); }} }}
302
-
303
  /* DATABASE */
304
  .db-wrap {{ position:relative;width:130px;display:flex;flex-direction:column;align-items:center; }}
305
  .db-label {{ font-size:.65rem;font-weight:600;letter-spacing:1.5px;text-transform:uppercase;color:#4a7a6a;margin-bottom:10px; }}
@@ -308,7 +301,6 @@ body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26;
308
  .anim-stage.active .cyl-right {{ opacity:1;transition-delay:2.2s; }}
309
  .anim-stage.active .cyl-front {{ opacity:1;transition-delay:2.4s;animation:frontPulse 2.4s ease-in-out infinite 2.8s; }}
310
  @keyframes frontPulse {{ 0%,100% {{ filter:brightness(1); }} 50% {{ filter:brightness(1.2); }} }}
311
-
312
  /* CAPTION */
313
  .anim-caption {{ margin-top:48px;display:flex;gap:40px;align-items:center; }}
314
  .anim-step {{ display:flex;align-items:center;gap:10px;opacity:0;transform:translateY(10px);transition:opacity .5s ease,transform .5s ease; }}
@@ -318,7 +310,6 @@ body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26;
318
  .step-text {{ font-size:.78rem;color:#5a8a7a;font-weight:500; }}
319
  </style>
320
  </head><body>
321
-
322
  <section class="anim-section">
323
  <h2 class="anim-title">From Experiment to Database</h2>
324
  <div class="anim-stage" id="animStage">
@@ -410,7 +401,6 @@ body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26;
410
  <div class="anim-step"><span class="step-text">Stored in AIM</span></div>
411
  </div>
412
  </section>
413
-
414
  <script>
415
  const stage = document.getElementById('animStage');
416
  const magWrap = document.getElementById('magWrap');
@@ -539,7 +529,7 @@ def _build_showcase_html(extract_b64, search_b64):
539
  "</div>"
540
  )
541
  extract_card = (
542
- "<div class=\"s-card\" onclick=\"document.getElementById('btn_upload').click()\">"
543
  "<img class=\"s-card-img\" src=\"" + extract_b64 + "\" alt=\"Extract Data\"/>"
544
  "<div class=\"s-card-body\">"
545
  "<div class=\"s-card-title\">Extract Data</div>"
@@ -548,7 +538,7 @@ def _build_showcase_html(extract_b64, search_b64):
548
  "</div></div>"
549
  )
550
  search_card = (
551
- "<div class=\"s-card\" onclick=\"document.getElementById('btn_search').click()\">"
552
  "<img class=\"s-card-img\" src=\"" + search_b64 + "\" alt=\"Search\"/>"
553
  "<div class=\"s-card-body\">"
554
  "<div class=\"s-card-title\">Search</div>"
@@ -630,7 +620,6 @@ components.html(f"""
630
  <style>
631
  *, *::before, *::after {{ box-sizing: border-box; margin: 0; padding: 0; }}
632
  body {{ font-family: 'DM Sans', sans-serif; color: #1a2e26; }}
633
-
634
  .aim-about {{ background: #fff; padding: 60px; border-bottom: 1px solid #e8e8e4; }}
635
  .aim-about h2 {{ font-size: 1.65rem; font-weight: 700; color: #0f1f1a; letter-spacing: -0.5px; margin-bottom: 8px; }}
636
  .aim-about-sub {{ color: #6a7e77; font-size: 0.9rem; margin-bottom: 30px; }}
@@ -643,13 +632,11 @@ body {{ font-family: 'DM Sans', sans-serif; color: #1a2e26; }}
643
  display: flex; align-items: center; justify-content: center;
644
  color: #7a9e8f; font-size: 0.85rem; border: 1.5px dashed #c8d6d0;
645
  }}
646
-
647
  .aim-footer {{ background: #fff; border-top: 1px solid #e8e8e4; padding: 50px 60px 28px; }}
648
  .aim-footer-brand {{ display: flex; align-items: center; gap: 8px; font-weight: 700; color: #0f1f1a; font-size: 0.95rem; margin-bottom: 10px; }}
649
  .aim-footer-desc {{ font-size: 0.82rem; color: #7a8e87; line-height: 1.6; }}
650
  </style>
651
  </head><body>
652
-
653
  <section class="aim-about">
654
  <h2>About the Platform</h2>
655
  <p class="aim-about-sub">Artificially Intelligent Manufacturing Paradigm (AIM) for Composites</p>
@@ -669,9 +656,6 @@ body {{ font-family: 'DM Sans', sans-serif; color: #1a2e26; }}
669
  <div>{about_img_html}</div>
670
  </div>
671
  </section>
672
-
673
-
674
-
675
  </body></html>
676
  """, height=550, scrolling=False)
677
 
@@ -737,7 +721,6 @@ div[data-testid="stHorizontalBlock"]:has(.footer-nav-head) {
737
  .st-emotion-cache-1qeq59m:hover p {
738
  color: #8ACAFF !important;
739
  }
740
-
741
  /* copyright bar */
742
  .aim-footer-bottom {
743
  background: #fff;
@@ -747,7 +730,6 @@ div[data-testid="stHorizontalBlock"]:has(.footer-nav-head) {
747
  color: #a0b0aa;
748
  font-family: 'DM Sans', sans-serif;
749
  }
750
-
751
  </style>
752
  """, unsafe_allow_html=True)
753
 
@@ -784,3 +766,4 @@ with _:
784
 
785
 
786
 
 
 
79
  st.markdown("""
80
  <style>
81
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap');
 
82
  /* Hide default Streamlit chrome */
83
  .block-container { padding: 0 !important; max-width: 100% !important; background: #fff !important;}
84
  [data-testid="stToolbar"],
85
  [data-testid="stDecoration"],
86
  [data-testid="stHeader"] { display: none !important; }
 
 
 
 
 
87
  /* ── Search row ── */
88
  /* Only target the search bar's horizontal block, not all columns */
89
  .st-emotion-cache-y1l7l5 .st-emotion-cache-1permvm {
90
  gap: 0 !important;
91
  align-items: stretch !important;
92
  }
 
93
  .st-emotion-cache-16s2yzk button {
94
  background: #f2f6f4 !important;
95
  border: 1.5px solid #d0d8d4 !important;
 
104
  white-space: nowrap !important;
105
  box-shadow: none !important;
106
  }
 
107
  .st-emotion-cache-4dubyl [data-baseweb="input"] {
108
  background: #000 !important;
109
  height: 46px !important;
 
125
  box-shadow: none !important;
126
  padding-left: 18px !important;
127
  }
 
128
  .st-emotion-cache-4dubyl > div {
 
129
  height: 46px !important;
130
  }
131
  .st-emotion-cache-4dubyl input::placeholder {
 
145
  padding: 0 28px !important;
146
  box-shadow: none !important;
147
  }
 
148
  .st-key-view_all_btn button {
149
  background: transparent !important;
150
  border: none !important;
 
172
  margin-bottom: 14px;
173
  font-family: 'DM Sans', sans-serif;
174
  }
 
175
  </style>
176
  """, unsafe_allow_html=True)
177
 
178
 
179
 
180
+ # Card click navigation handler
181
+ _nav = st.query_params.get("nav", None)
182
+ if _nav == "upload":
183
+ st.query_params.clear()
184
+ st.switch_page("page_files/Upload_Data.py")
185
+ elif _nav == "search":
186
+ st.query_params.clear()
187
+ st.switch_page("page_files/Categorized_Search.py")
188
+
189
  # PostMessage listener for iframe card clicks
190
  components.html("""
191
  <script>
 
248
  <style>
249
  *, *::before, *::after {{ box-sizing: border-box; margin: 0; padding: 0; }}
250
  body {{ font-family: 'DM Sans', sans-serif; background: #f7f7f5; color: #1a2e26; overflow-x: hidden; }}
 
251
  /* ANIMATION SECTION */
252
  .anim-section {{
253
  background: #000;
 
263
  display: flex; align-items: center;
264
  justify-content: space-between; padding: 0 40px;
265
  }}
 
266
  /* MAG GLASS */
267
  .mag-wrap {{ position: relative; width: 100px; display: flex; flex-direction: column; align-items: center; }}
268
  .mag-label {{ font-size: 0.65rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #4a7a6a; margin-bottom: 10px; }}
 
273
  .mag-scan {{ opacity: 0; transition: opacity 0.3s ease 0.8s; }}
274
  .mag-wrap.active .mag-scan {{ opacity: 1; animation: scanMove 1.2s ease-in-out infinite 0.8s; }}
275
  @keyframes scanMove {{ 0% {{ transform:translateY(-14px);opacity:.8; }} 50% {{ transform:translateY(0);opacity:1; }} 100% {{ transform:translateY(14px);opacity:.8; }} }}
 
276
  /* BUBBLES */
277
  .bubble {{ position:absolute; border-radius:50%; background:radial-gradient(circle at 35% 35%,rgba(255,255,255,.6),rgba(80,160,255,.25)); border:1px solid rgba(100,180,255,.4); opacity:0; pointer-events:none; backdrop-filter:blur(2px); }}
278
  .b1 {{ width:18px;height:18px;left:108px;bottom:155px; }}
 
293
  @keyframes floatBubble4 {{ 0% {{ opacity:0;transform:translate(0,0) scale(.3); }} 20% {{ opacity:1;transform:translate(-8px,-35px) scale(1); }} 65% {{ opacity:.8;transform:translate(105px,-80px) scale(.8); }} 88% {{ opacity:.3;transform:translate(255px,-50px) scale(.4); }} 100% {{ opacity:0;transform:translate(320px,-20px) scale(.1); }} }}
294
  @keyframes floatBubble5 {{ 0% {{ opacity:0;transform:translate(0,0) scale(.4); }} 15% {{ opacity:1;transform:translate(3px,-22px) scale(1); }} 58% {{ opacity:.9;transform:translate(115px,-60px) scale(.88); }} 83% {{ opacity:.45;transform:translate(270px,-35px) scale(.55); }} 100% {{ opacity:0;transform:translate(335px,-12px) scale(.2); }} }}
295
  @keyframes floatBubble6 {{ 0% {{ opacity:0;transform:translate(0,0) scale(.25); }} 20% {{ opacity:1;transform:translate(-3px,-40px) scale(1); }} 62% {{ opacity:.7;transform:translate(100px,-85px) scale(.75); }} 85% {{ opacity:.25;transform:translate(250px,-55px) scale(.35); }} 100% {{ opacity:0;transform:translate(318px,-22px) scale(.1); }} }}
 
296
  /* DATABASE */
297
  .db-wrap {{ position:relative;width:130px;display:flex;flex-direction:column;align-items:center; }}
298
  .db-label {{ font-size:.65rem;font-weight:600;letter-spacing:1.5px;text-transform:uppercase;color:#4a7a6a;margin-bottom:10px; }}
 
301
  .anim-stage.active .cyl-right {{ opacity:1;transition-delay:2.2s; }}
302
  .anim-stage.active .cyl-front {{ opacity:1;transition-delay:2.4s;animation:frontPulse 2.4s ease-in-out infinite 2.8s; }}
303
  @keyframes frontPulse {{ 0%,100% {{ filter:brightness(1); }} 50% {{ filter:brightness(1.2); }} }}
 
304
  /* CAPTION */
305
  .anim-caption {{ margin-top:48px;display:flex;gap:40px;align-items:center; }}
306
  .anim-step {{ display:flex;align-items:center;gap:10px;opacity:0;transform:translateY(10px);transition:opacity .5s ease,transform .5s ease; }}
 
310
  .step-text {{ font-size:.78rem;color:#5a8a7a;font-weight:500; }}
311
  </style>
312
  </head><body>
 
313
  <section class="anim-section">
314
  <h2 class="anim-title">From Experiment to Database</h2>
315
  <div class="anim-stage" id="animStage">
 
401
  <div class="anim-step"><span class="step-text">Stored in AIM</span></div>
402
  </div>
403
  </section>
 
404
  <script>
405
  const stage = document.getElementById('animStage');
406
  const magWrap = document.getElementById('magWrap');
 
529
  "</div>"
530
  )
531
  extract_card = (
532
+ "<div class=\"s-card\" onclick=\"window.parent.location.href='?nav=upload'\">"
533
  "<img class=\"s-card-img\" src=\"" + extract_b64 + "\" alt=\"Extract Data\"/>"
534
  "<div class=\"s-card-body\">"
535
  "<div class=\"s-card-title\">Extract Data</div>"
 
538
  "</div></div>"
539
  )
540
  search_card = (
541
+ "<div class=\"s-card\" onclick=\"window.parent.location.href='?nav=search'\">"
542
  "<img class=\"s-card-img\" src=\"" + search_b64 + "\" alt=\"Search\"/>"
543
  "<div class=\"s-card-body\">"
544
  "<div class=\"s-card-title\">Search</div>"
 
620
  <style>
621
  *, *::before, *::after {{ box-sizing: border-box; margin: 0; padding: 0; }}
622
  body {{ font-family: 'DM Sans', sans-serif; color: #1a2e26; }}
 
623
  .aim-about {{ background: #fff; padding: 60px; border-bottom: 1px solid #e8e8e4; }}
624
  .aim-about h2 {{ font-size: 1.65rem; font-weight: 700; color: #0f1f1a; letter-spacing: -0.5px; margin-bottom: 8px; }}
625
  .aim-about-sub {{ color: #6a7e77; font-size: 0.9rem; margin-bottom: 30px; }}
 
632
  display: flex; align-items: center; justify-content: center;
633
  color: #7a9e8f; font-size: 0.85rem; border: 1.5px dashed #c8d6d0;
634
  }}
 
635
  .aim-footer {{ background: #fff; border-top: 1px solid #e8e8e4; padding: 50px 60px 28px; }}
636
  .aim-footer-brand {{ display: flex; align-items: center; gap: 8px; font-weight: 700; color: #0f1f1a; font-size: 0.95rem; margin-bottom: 10px; }}
637
  .aim-footer-desc {{ font-size: 0.82rem; color: #7a8e87; line-height: 1.6; }}
638
  </style>
639
  </head><body>
 
640
  <section class="aim-about">
641
  <h2>About the Platform</h2>
642
  <p class="aim-about-sub">Artificially Intelligent Manufacturing Paradigm (AIM) for Composites</p>
 
656
  <div>{about_img_html}</div>
657
  </div>
658
  </section>
 
 
 
659
  </body></html>
660
  """, height=550, scrolling=False)
661
 
 
721
  .st-emotion-cache-1qeq59m:hover p {
722
  color: #8ACAFF !important;
723
  }
 
724
  /* copyright bar */
725
  .aim-footer-bottom {
726
  background: #fff;
 
730
  color: #a0b0aa;
731
  font-family: 'DM Sans', sans-serif;
732
  }
 
733
  </style>
734
  """, unsafe_allow_html=True)
735
 
 
766
 
767
 
768
 
769
+