Update app.py
Browse fileslogo loading and animation testing
app.py
CHANGED
|
@@ -71,19 +71,18 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 71 |
)
|
| 72 |
|
| 73 |
with gr.Column(scale=3):
|
| 74 |
-
# --- DeepV Logo
|
| 75 |
with gr.Row(elem_id="logo-and-output-row"):
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
)
|
| 87 |
gr.Markdown("**Output**", elem_id="output-title")
|
| 88 |
|
| 89 |
with gr.Group():
|
|
@@ -157,47 +156,92 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 157 |
demo.css = """
|
| 158 |
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap');
|
| 159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
#main-title {
|
| 161 |
font-family: 'Poppins', sans-serif;
|
| 162 |
font-weight: 600;
|
| 163 |
letter-spacing: 1px;
|
| 164 |
}
|
| 165 |
|
| 166 |
-
/*
|
| 167 |
#logo-and-output-row {
|
| 168 |
display: flex;
|
| 169 |
align-items: center; /* Vertically align items */
|
| 170 |
justify-content: center; /* Horizontally center contents */
|
| 171 |
margin-bottom: 10px; /* Space between logo/title and output textbox */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
| 176 |
}
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
}
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
#output-title {
|
| 184 |
margin: 0; /* Remove default margin from Markdown to prevent offset */
|
| 185 |
-
font-size: 1.2em;
|
| 186 |
font-weight: bold;
|
|
|
|
|
|
|
| 187 |
}
|
| 188 |
|
| 189 |
-
/*
|
| 190 |
-
@keyframes fadeInScale {
|
| 191 |
-
0% {
|
| 192 |
-
opacity: 0;
|
| 193 |
-
transform: scale(0.8);
|
| 194 |
-
}
|
| 195 |
-
100% {
|
| 196 |
-
opacity: 1;
|
| 197 |
-
transform: scale(1);
|
| 198 |
-
}
|
| 199 |
-
}
|
| 200 |
-
|
| 201 |
#verilog-output > label > .label-wrap {
|
| 202 |
position: relative;
|
| 203 |
}
|
|
@@ -233,6 +277,77 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 233 |
}
|
| 234 |
"""
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
if __name__ == "__main__":
|
| 237 |
if 'agent_module' in locals():
|
| 238 |
demo.launch()
|
|
|
|
| 71 |
)
|
| 72 |
|
| 73 |
with gr.Column(scale=3):
|
| 74 |
+
# --- DeepV Logo with CSS Background Image and animation ---
|
| 75 |
with gr.Row(elem_id="logo-and-output-row"):
|
| 76 |
+
# The div for the logo - the animation will be applied here
|
| 77 |
+
gr.HTML("""
|
| 78 |
+
<div id="animated-deepv-logo">
|
| 79 |
+
<span class="deepv-char" id="deepv-D">D</span>
|
| 80 |
+
<span class="deepv-char" id="deepv-E1">E</span>
|
| 81 |
+
<span class="deepv-char" id="deepv-E2">E</span>
|
| 82 |
+
<span class="deepv-char" id="deepv-P">P</span>
|
| 83 |
+
<span class="deepv-char" id="deepv-V">V</span>
|
| 84 |
+
</div>
|
| 85 |
+
""")
|
|
|
|
| 86 |
gr.Markdown("**Output**", elem_id="output-title")
|
| 87 |
|
| 88 |
with gr.Group():
|
|
|
|
| 156 |
demo.css = """
|
| 157 |
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap');
|
| 158 |
|
| 159 |
+
/* Define CSS Variables for colors */
|
| 160 |
+
:root {
|
| 161 |
+
--deep-blue: #007bff; /* A nice bright blue */
|
| 162 |
+
--v-orange: #ffa500; /* An orange for the V */
|
| 163 |
+
--text-color: #333;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
#main-title {
|
| 167 |
font-family: 'Poppins', sans-serif;
|
| 168 |
font-weight: 600;
|
| 169 |
letter-spacing: 1px;
|
| 170 |
}
|
| 171 |
|
| 172 |
+
/* Logo and Output Row Layout */
|
| 173 |
#logo-and-output-row {
|
| 174 |
display: flex;
|
| 175 |
align-items: center; /* Vertically align items */
|
| 176 |
justify-content: center; /* Horizontally center contents */
|
| 177 |
margin-bottom: 10px; /* Space between logo/title and output textbox */
|
| 178 |
+
height: 80px; /* Give it enough height for the animation */
|
| 179 |
+
position: relative; /* For absolute positioning of letters */
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/* Styling for the animated logo container */
|
| 183 |
+
#animated-deepv-logo {
|
| 184 |
+
position: relative;
|
| 185 |
+
width: 150px; /* Adjust width to fit "DEEPV" */
|
| 186 |
+
height: 70px; /* Adjust height to fit "DEEPV" */
|
| 187 |
+
display: flex; /* Use flex to align characters (initial state) */
|
| 188 |
+
justify-content: center;
|
| 189 |
+
align-items: center;
|
| 190 |
+
font-family: 'Poppins', sans-serif;
|
| 191 |
+
font-weight: 800;
|
| 192 |
+
font-size: 4em; /* Make the V bigger */
|
| 193 |
+
line-height: 1;
|
| 194 |
+
overflow: hidden; /* Hide parts that are off-screen during animation */
|
| 195 |
+
padding-right: 15px; /* Adjust for V overlap */
|
| 196 |
}
|
| 197 |
|
| 198 |
+
.deepv-char {
|
| 199 |
+
position: absolute; /* Position characters independently */
|
| 200 |
+
opacity: 0;
|
| 201 |
+
transition: all 0.3s ease-out; /* Smooth transitions for non-animated changes */
|
| 202 |
+
white-space: nowrap;
|
| 203 |
}
|
| 204 |
|
| 205 |
+
#deepv-V {
|
| 206 |
+
color: var(--v-orange);
|
| 207 |
+
font-size: 1.5em; /* Make V even bigger */
|
| 208 |
+
opacity: 1; /* V is always present */
|
| 209 |
+
top: 50%;
|
| 210 |
+
left: 50%;
|
| 211 |
+
transform: translate(-50%, -50%); /* Center the V */
|
| 212 |
+
z-index: 1; /* V is behind other letters initially */
|
| 213 |
}
|
| 214 |
|
| 215 |
+
/* Positioning for DEEP letters relative to V */
|
| 216 |
+
#deepv-D { top: 50%; left: 30%; color: var(--deep-blue); transform: translate(-50%, -50%); z-index: 2; }
|
| 217 |
+
#deepv-E1 { top: 50%; left: 45%; color: var(--deep-blue); transform: translate(-50%, -50%); z-index: 2; }
|
| 218 |
+
#deepv-E2 { top: 50%; left: 60%; color: var(--deep-blue); transform: translate(-50%, -50%); z-index: 2; }
|
| 219 |
+
#deepv-P { top: 50%; left: 75%; color: var(--deep-blue); transform: translate(-50%, -50%); z-index: 2; }
|
| 220 |
+
|
| 221 |
+
/* Animation Keyframes */
|
| 222 |
+
@keyframes charAppear {
|
| 223 |
+
0% { opacity: 0; transform: translate(-50%, -100%) scale(0.5); }
|
| 224 |
+
50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
|
| 225 |
+
100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
@keyframes charHopAway {
|
| 229 |
+
0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
|
| 230 |
+
50% { opacity: 1; transform: translate(-50%, -100%) scale(1.1); }
|
| 231 |
+
100% { opacity: 0; transform: translate(-50%, -200%) scale(0.5); } /* Hop upwards and fade */
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
/* Output Title Styling */
|
| 236 |
#output-title {
|
| 237 |
margin: 0; /* Remove default margin from Markdown to prevent offset */
|
| 238 |
+
font-size: 1.2em;
|
| 239 |
font-weight: bold;
|
| 240 |
+
margin-left: 20px; /* Adjust spacing from the logo */
|
| 241 |
+
animation: fadeInScale 1.5s ease-out forwards; /* Keep fade animation */
|
| 242 |
}
|
| 243 |
|
| 244 |
+
/* General UI element styling */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
#verilog-output > label > .label-wrap {
|
| 246 |
position: relative;
|
| 247 |
}
|
|
|
|
| 277 |
}
|
| 278 |
"""
|
| 279 |
|
| 280 |
+
# --- JavaScript for the custom animation ---
|
| 281 |
+
demo.load(
|
| 282 |
+
None,
|
| 283 |
+
None,
|
| 284 |
+
None,
|
| 285 |
+
_js="""
|
| 286 |
+
() => {
|
| 287 |
+
const chars = ['deepv-D', 'deepv-E1', 'deepv-E2', 'deepv-P'];
|
| 288 |
+
const V_char = document.getElementById('deepv-V');
|
| 289 |
+
let charIndex = 0;
|
| 290 |
+
|
| 291 |
+
const animateLogo = () => {
|
| 292 |
+
// Reset all DEEP characters
|
| 293 |
+
chars.forEach(id => {
|
| 294 |
+
const char = document.getElementById(id);
|
| 295 |
+
if (char) {
|
| 296 |
+
char.style.opacity = '0';
|
| 297 |
+
char.style.transform = 'translate(-50%, -50%)';
|
| 298 |
+
char.classList.remove('hop-away'); // Remove previous animation class
|
| 299 |
+
}
|
| 300 |
+
});
|
| 301 |
+
|
| 302 |
+
// Animate V's position slightly
|
| 303 |
+
if (V_char) {
|
| 304 |
+
V_char.style.transform = 'translate(-50%, -50%) scale(1.1)'; // Slight scale up
|
| 305 |
+
setTimeout(() => {
|
| 306 |
+
V_char.style.transform = 'translate(-50%, -50%) scale(1)'; // Scale back down
|
| 307 |
+
}, 500);
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
// Animate DEEP characters one by one
|
| 312 |
+
charIndex = 0;
|
| 313 |
+
const appearInterval = setInterval(() => {
|
| 314 |
+
if (charIndex < chars.length) {
|
| 315 |
+
const char = document.getElementById(chars[charIndex]);
|
| 316 |
+
if (char) {
|
| 317 |
+
char.style.opacity = '1';
|
| 318 |
+
char.style.transform = 'translate(-50%, -50%)'; // Reset position
|
| 319 |
+
char.style.animation = 'charAppear 0.5s ease-out forwards';
|
| 320 |
+
}
|
| 321 |
+
charIndex++;
|
| 322 |
+
} else {
|
| 323 |
+
clearInterval(appearInterval);
|
| 324 |
+
// After all DEEP letters appear, wait a bit then make them hop away
|
| 325 |
+
setTimeout(() => {
|
| 326 |
+
let hopIndex = 0;
|
| 327 |
+
const hopInterval = setInterval(() => {
|
| 328 |
+
if (hopIndex < chars.length) {
|
| 329 |
+
const char = document.getElementById(chars[hopIndex]);
|
| 330 |
+
if (char) {
|
| 331 |
+
char.style.animation = 'charHopAway 0.8s ease-in forwards';
|
| 332 |
+
}
|
| 333 |
+
hopIndex++;
|
| 334 |
+
} else {
|
| 335 |
+
clearInterval(hopInterval);
|
| 336 |
+
}
|
| 337 |
+
}, 150); // Delay between each letter hopping away
|
| 338 |
+
}, 1000); // Delay before letters start hopping away
|
| 339 |
+
}
|
| 340 |
+
}, 200); // Delay between each letter appearing
|
| 341 |
+
};
|
| 342 |
+
|
| 343 |
+
// Run the animation every few seconds
|
| 344 |
+
setInterval(animateLogo, 4000); // Total animation time ~3s, so repeat every 4s
|
| 345 |
+
animateLogo(); // Run once immediately on load
|
| 346 |
+
}
|
| 347 |
+
"""
|
| 348 |
+
)
|
| 349 |
+
|
| 350 |
+
|
| 351 |
if __name__ == "__main__":
|
| 352 |
if 'agent_module' in locals():
|
| 353 |
demo.launch()
|