import streamlit as st import streamlit.components.v1 as components from pathlib import Path import base64 from data_loader import get_all_sections import random import re ALL_CARDS = [ ("Composites", "Material class", "material", "Composites"), ("Polymers", "Material class", "material", "Polymers"), ("Fibers", "Material class", "material", "Fibers"), ] sections = get_all_sections() for section in sections: ALL_CARDS.append((section, "Property type", "section", section)) if "visible_cards" not in st.session_state: random.shuffle(ALL_CARDS) st.session_state.visible_cards = ALL_CARDS[:4] VISIBLE_CARDS = st.session_state.visible_cards prop_count = len([c for c in ALL_CARDS if c[2] == "section"]) def get_card_icon(title: str, card_type: str) -> str: if card_type == "material": icons = {"composites": "๐Ÿงฑ", "polymers": "๐Ÿ”ฌ", "fibers": "๐Ÿงต"} return icons.get(title.lower(), "๐Ÿงฑ") t = title.lower() if "mechanical" in t: return "โš™๏ธ" if "thermal" in t: return "๐Ÿ”ฅ" if "electrical" in t: return "โšก" if "physical" in t: return "โš–๏ธ" if "processing" in t: return "๐Ÿ”ง" if "optical" in t: return "๐Ÿ”ญ" if "chemical" in t: return "๐Ÿงช" if "flammab" in t: return "๐Ÿ”ด" if "component" in t: return "๐Ÿงฉ" if "descriptive" in t: return "๐Ÿ“‹" return "๐Ÿ“‹" def img_to_b64(path): try: ext = Path(path).suffix.lower().replace(".", "") mime = "png" if ext == "png" else "jpeg" with open(path, "rb") as f: data = base64.b64encode(f.read()).decode() return f"data:image/{mime};base64,{data}" except Exception: return "" home_img = img_to_b64("images/Home.png") logo_img = img_to_b64("logo.png") st.markdown(""" """, unsafe_allow_html=True ) # Global style overrides st.markdown(""" """, unsafe_allow_html=True) # Helper def go_categorized(material=None, search=None): if material: st.session_state.material_type = material if search: st.session_state.search_term = search st.switch_page("page_files/Categorized_Search.py") def go_upload(): st.switch_page("page_files/Upload_Data.py") # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # 1. ANIMATION SECTION (pure HTML, no clickables needed) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• about_img_html = ( f"
AIM platform diagram
" if home_img else "
[ Platform diagram ]
" ) logo_html = ( f"AIM Logo" if logo_img else "" ) components.html(f"""

From Experiment to Database

Research
Database
Collect measurements
Process & validate
Stored in AIM
""", height=700, scrolling=False) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # 2. HERO , heading + description (static HTML) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• st.markdown(""" """, unsafe_allow_html=True) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # 5. MAJOR CATEGORIES , Streamlit columns + containers + buttons # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• st.markdown(""" """, unsafe_allow_html=True) st.markdown("
", unsafe_allow_html=True) # st.markdown(""" #
#

Quick Links

#

Open the pages you need most.

#
# """, unsafe_allow_html=True) quick_cards = [ ("Search", "Data Page", "page_files/Categorized_Search.py", "search", "๐Ÿ”Ž"), ("Extract Data", "Platform", "page_files/Upload_Data.py", "about", "๐Ÿ“‹"), ] col1, col2 = st.columns([5, 4], gap="large") with col1: st.markdown("""

Accelerate Your Composites Research

Access a centralized, open-source database for experimental composite material properties. Polymer, fiber, and composite datasets โ€” all in one place.

""", unsafe_allow_html=True) with col2: st.markdown("
", unsafe_allow_html=True) cols = st.columns(2, gap="large") for col, (title, tag, target_page, key_suffix, badge) in zip(cols, quick_cards): with col: if st.button( f"{badge}\n\n{title}\n\n{tag}", key=f"quick_{key_suffix}_page", use_container_width=True, ): st.switch_page(target_page) st.markdown("
", unsafe_allow_html=True) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # 4. STATS (static HTML) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• st.markdown(f"""
3
Material Classes
{prop_count}
Properties Tracked
8
Research Teams
2
Universities
""", unsafe_allow_html=True) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• # 6. ABOUT + FOOTER (static HTML) # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• components.html(f"""

About the Platform

Artificially Intelligent Manufacturing Paradigm (AIM) for Composites

The AIM Database tool serves as a powerful, centralized hub designed to streamline collaboration and information exchange within the composite materials research community. The platform enables researchers to contribute to a shared knowledge base by uploading experimental datasets through secure terminals.

Users can submit specific measurements regarding mechanical properties, thermal behavior, and rheology, alongside their published journal papers , ensuring that both raw data and peer-reviewed findings are integrated into one cohesive system.

All contributed information is securely aggregated within a central cloud architecture, allowing for efficient storage, organization, and retrieval across polymer, fiber, and composite categories.

{about_img_html}
""", height=550, scrolling=False) st.markdown(""" """, unsafe_allow_html=True) brand_col, db_col, sup_col, _ = st.columns([4, 2, 2, 2], vertical_alignment="top", width="stretch") with brand_col: st.markdown(f""" """, unsafe_allow_html=True) with sup_col: st.markdown('', unsafe_allow_html=True) st.page_link( "page_files/Categorized_Search.py", label="Browse Materials", ) st.page_link( "page_files/Categorized_Search.py", label="Categorized Search", ) st.page_link( "page_files/Upload_Data.py", label="Upload Data", ) with _: st.markdown('', unsafe_allow_html=True) st.page_link( "page_files/Contact_Team.py", label="Contact Team", )