Spaces:
Sleeping
Sleeping
Update home.py
Browse files
home.py
CHANGED
|
@@ -1,144 +1,153 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import streamlit.components.v1 as components
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
<div
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
""
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
.
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
</
|
| 136 |
-
"""
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
<
|
| 142 |
-
<
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
+
from streamlit_extras.switch_page_button import switch_page
|
| 4 |
+
import login_page
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def show():
|
| 8 |
+
# Top-right Logout button
|
| 9 |
+
col1, col2 = st.columns([8, 2])
|
| 10 |
+
with col2:
|
| 11 |
+
if st.button("Logout", key="logout_btn"):
|
| 12 |
+
st.session_state.logged_in = False
|
| 13 |
+
st.session_state.page = "Home"
|
| 14 |
+
st.rerun()
|
| 15 |
+
|
| 16 |
+
# Hero Section
|
| 17 |
+
st.markdown("""
|
| 18 |
+
<div style="background: linear-gradient(to right, #2c3e50, #3498db); height: 300px;">
|
| 19 |
+
<h1 style="text-align:center; color:white; padding-top:100px; font-family: Arial; font-weight: bold;">🧬 TransPolymer</h1>
|
| 20 |
+
<h3 style="text-align:center; color:white; font-family: Arial;">A Transformer-based AI Model for Polymer Property Predictions</h3>
|
| 21 |
+
</div>
|
| 22 |
+
""", unsafe_allow_html=True)
|
| 23 |
+
|
| 24 |
+
# Typing Animation
|
| 25 |
+
components.html("""
|
| 26 |
+
<div style="display:flex; justify-content:center; align-items:center; height:120px;">
|
| 27 |
+
<span id="typed-output" style="font-size:24px; color:white; font-family:Arial;"></span>
|
| 28 |
+
<span id="cursor" style="font-size:24px; color:white; margin-left:2px;">|</span>
|
| 29 |
+
</div>
|
| 30 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
|
| 31 |
+
<script>
|
| 32 |
+
const typed = new Typed('#typed-output', {
|
| 33 |
+
strings: [
|
| 34 |
+
"Predict Polymer Properties Instantly",
|
| 35 |
+
"Powered by Transformers and Chemistry",
|
| 36 |
+
"SMILES In, Predictions Out",
|
| 37 |
+
"Design Better Polymers with AI",
|
| 38 |
+
"Empowering Researchers through AI"
|
| 39 |
+
],
|
| 40 |
+
typeSpeed: 50, backSpeed: 30, loop: true, showCursor: false
|
| 41 |
+
});
|
| 42 |
+
setInterval(() => {
|
| 43 |
+
const cursor = document.getElementById("cursor");
|
| 44 |
+
cursor.style.visibility = (cursor.style.visibility === "hidden") ? "visible" : "hidden";
|
| 45 |
+
}, 500);
|
| 46 |
+
</script>
|
| 47 |
+
""", height=120)
|
| 48 |
+
|
| 49 |
+
# Flip Cards
|
| 50 |
+
st.markdown("""
|
| 51 |
+
<style>
|
| 52 |
+
.card-container { display: flex; justify-content: center; gap: 20px; margin-top: 50px; }
|
| 53 |
+
.flip-card { width: 250px; height: 300px; perspective: 1000px; }
|
| 54 |
+
.flip-card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.6s; }
|
| 55 |
+
.flip-card:hover .flip-card-inner { transform: rotateY(180deg); }
|
| 56 |
+
.flip-card-front, .flip-card-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; padding: 20px; border-radius: 10px; }
|
| 57 |
+
.flip-card-front { background-color: #ffffff; border: 2px solid #8e44ad; display: flex; justify-content: center; align-items: center; font-size: 20px; color: #8e44ad; font-family: 'Arial', sans-serif; font-weight: bold; }
|
| 58 |
+
.flip-card-back { background-color: #8e44ad; color: white; transform: rotateY(180deg); text-align: center; font-family: 'Arial', sans-serif; }
|
| 59 |
+
.flip-card-back h4 { color: #ffffff; }
|
| 60 |
+
.flip-card-back p { color: #f1f1f1; font-size: 14px; }
|
| 61 |
+
</style>
|
| 62 |
+
<div class="card-container">
|
| 63 |
+
<div class="flip-card">
|
| 64 |
+
<div class="flip-card-inner">
|
| 65 |
+
<div class="flip-card-front">Polymer Property Prediction</div>
|
| 66 |
+
<div class="flip-card-back"><h4>Polymer Property Prediction</h4><p>Using advanced AI models to make accurate and fast polymer property predictions.</p></div>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="flip-card">
|
| 70 |
+
<div class="flip-card-inner">
|
| 71 |
+
<div class="flip-card-front">SMILES Input</div>
|
| 72 |
+
<div class="flip-card-back"><h4>SMILES Input</h4><p>TransPolymer works with SMILES strings to generate accurate predictions of polymer properties.</p></div>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
<div class="flip-card">
|
| 76 |
+
<div class="flip-card-inner">
|
| 77 |
+
<div class="flip-card-front">Transformer Technology</div>
|
| 78 |
+
<div class="flip-card-back"><h4>Transformer Technology</h4><p>Built on the powerful Transformer architecture .</p></div>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
""", unsafe_allow_html=True)
|
| 83 |
+
|
| 84 |
+
st.markdown("""
|
| 85 |
+
<div style='
|
| 86 |
+
padding: 25px;
|
| 87 |
+
background: #fcf3cf;
|
| 88 |
+
border-left: 6px solid #f39c12;
|
| 89 |
+
border-radius: 12px;
|
| 90 |
+
margin-top: 20px;
|
| 91 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
| 92 |
+
'>
|
| 93 |
+
<h4 style='color: #d35400; text-align: center; font-family: Arial;'>What is TransPolymer?</h4>
|
| 94 |
+
<p style='color: #333; font-size: 16px; text-align: center; font-family: Arial;'>
|
| 95 |
+
<strong style="color: #e67e22;">TransPolymer</strong> is a powerful AI assistant that predicts physical and chemical properties of polymers using deep learning techniques.<br>
|
| 96 |
+
It transforms molecular SMILES strings into property insights within seconds.
|
| 97 |
+
</p>
|
| 98 |
+
<div style='display: flex; flex-direction: column; align-items: center;'>
|
| 99 |
+
<ul style='color: #e67e22; font-size: 15px; list-style: none; padding-left: 0; text-align: left; font-family: Arial;'>
|
| 100 |
+
<li>⚡ Fast predictions driven by Transformer architecture</li>
|
| 101 |
+
<li>🔍 Supports polymer innovation and discovery</li>
|
| 102 |
+
</ul>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
""", unsafe_allow_html=True)
|
| 106 |
+
|
| 107 |
+
# Circular Layout
|
| 108 |
+
components.html("""
|
| 109 |
+
<style>
|
| 110 |
+
.circle-container { position:relative; width:500px; height:500px; margin:40px auto; cursor:pointer; }
|
| 111 |
+
.center-circle {
|
| 112 |
+
width:180px; height:180px; background:#27ae60; border-radius:50%;
|
| 113 |
+
position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
|
| 114 |
+
display:flex; align-items:center; justify-content:center;
|
| 115 |
+
color:#fff; font-size:14px; font-weight:bold; text-align:center;
|
| 116 |
+
animation:pulse 2s infinite;
|
| 117 |
+
}
|
| 118 |
+
.property-circle {
|
| 119 |
+
width:120px; height:120px; border-radius:50%;
|
| 120 |
+
position:absolute; display:flex; align-items:center; justify-content:center;
|
| 121 |
+
color:#fff; font-size:13px; font-weight:bold; text-align:center;
|
| 122 |
+
visibility:hidden; opacity:0; transition:all 0.5s ease; padding:10px;
|
| 123 |
+
}
|
| 124 |
+
.circle-container.show .property-circle { visibility:visible; opacity:1; }
|
| 125 |
+
.p1 { background:#1abc9c; top:10%; left:50%; transform:translate(-50%, -50%); }
|
| 126 |
+
.p2 { background:#3498db; top:30%; left:85%; transform:translate(-50%, -50%); }
|
| 127 |
+
.p3 { background:#9b59b6; top:70%; left:85%; transform:translate(-50%, -50%); }
|
| 128 |
+
.p4 { background:#e67e22; top:90%; left:50%; transform:translate(-50%, -50%); }
|
| 129 |
+
.p5 { background:#f39c12; top:70%; left:15%; transform:translate(-50%, -50%); }
|
| 130 |
+
.p6 { background:#e74c3c; top:30%; left:15%; transform:translate(-50%, -50%); }
|
| 131 |
+
@keyframes pulse {
|
| 132 |
+
0%,100% { transform:translate(-50%, -50%) scale(1); }
|
| 133 |
+
50% { transform:translate(-50%, -50%) scale(1.05); }
|
| 134 |
+
}
|
| 135 |
+
</style>
|
| 136 |
+
<div class="circle-container" id="circleLayout" onclick="this.classList.add('show')">
|
| 137 |
+
<div class="center-circle">Who Can Use TransPolymer?</div>
|
| 138 |
+
<div class="property-circle p1">Polymer Scientists</div>
|
| 139 |
+
<div class="property-circle p2">Drug Delivery Researchers</div>
|
| 140 |
+
<div class="property-circle p3">Materials Scientists</div>
|
| 141 |
+
<div class="property-circle p4">Optical Material Engineers</div>
|
| 142 |
+
<div class="property-circle p5">Environmental Researchers</div>
|
| 143 |
+
<div class="property-circle p6">Students in Chemistry</div>
|
| 144 |
+
</div>
|
| 145 |
+
""", height=600)
|
| 146 |
+
|
| 147 |
+
# Footer
|
| 148 |
+
st.markdown("""
|
| 149 |
+
<div style="text-align:center; margin-top:50px;">
|
| 150 |
+
<p style="color:#555; font-family:Arial;">Transpolymer - Simple. Smart. Scientific</p>
|
| 151 |
+
<p style="color:#888; font-family:Arial; font-size:14px;">© 2025 TransPolymer. All rights reserved.</p>
|
| 152 |
+
</div>
|
| 153 |
+
""", unsafe_allow_html=True)
|