Spaces:
Sleeping
Sleeping
Mahdi Naser Moghadasi commited on
Commit Β·
91c4632
1
Parent(s): a372a30
Modernize UI: Add advanced styling, animations, and modern card design for all tabs
Browse files
app.py
CHANGED
|
@@ -1291,6 +1291,347 @@ with gr.Blocks(
|
|
| 1291 |
title="BrightMind AI - Educational Content Generator",
|
| 1292 |
theme=gr.themes.Soft(),
|
| 1293 |
css="""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1294 |
.progress-container {
|
| 1295 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 1296 |
border-radius: 15px;
|
|
@@ -1536,10 +1877,10 @@ with gr.Blocks(
|
|
| 1536 |
"""
|
| 1537 |
) as demo:
|
| 1538 |
|
| 1539 |
-
#
|
| 1540 |
with gr.Row():
|
| 1541 |
gr.HTML("""
|
| 1542 |
-
<div class="
|
| 1543 |
<h1>π§ BrightMind AI</h1>
|
| 1544 |
<p>Professional Educational Content Generator for Teachers</p>
|
| 1545 |
</div>
|
|
@@ -1549,13 +1890,22 @@ with gr.Blocks(
|
|
| 1549 |
with gr.TabItem("π§ Ask Albert"):
|
| 1550 |
with gr.Row():
|
| 1551 |
with gr.Column(scale=1):
|
| 1552 |
-
gr.
|
| 1553 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1554 |
|
| 1555 |
-
|
|
|
|
|
|
|
|
|
|
| 1556 |
""")
|
| 1557 |
|
| 1558 |
-
# User setup
|
| 1559 |
user_name = gr.Textbox(
|
| 1560 |
label="π What's your name?",
|
| 1561 |
placeholder="Enter your name here...",
|
|
@@ -1568,33 +1918,48 @@ with gr.Blocks(
|
|
| 1568 |
value="6-8"
|
| 1569 |
)
|
| 1570 |
|
| 1571 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1572 |
|
| 1573 |
-
# Chat interface
|
| 1574 |
chat_input = gr.Textbox(
|
| 1575 |
-
label="
|
| 1576 |
placeholder="Type your question here...",
|
| 1577 |
-
lines=
|
| 1578 |
)
|
| 1579 |
|
| 1580 |
with gr.Row():
|
| 1581 |
-
send_btn = gr.Button("π Send", variant="primary"
|
| 1582 |
-
clear_btn = gr.Button("ποΈ Clear", variant="secondary"
|
|
|
|
|
|
|
| 1583 |
|
| 1584 |
|
| 1585 |
with gr.Column(scale=2):
|
| 1586 |
-
#
|
| 1587 |
-
|
| 1588 |
-
<div
|
| 1589 |
-
<div style="
|
|
|
|
|
|
|
|
|
|
| 1590 |
</div>
|
| 1591 |
""")
|
| 1592 |
|
| 1593 |
-
# Chat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1594 |
chat_display = gr.Chatbot(
|
| 1595 |
-
label="
|
| 1596 |
-
height=
|
| 1597 |
-
show_label=
|
| 1598 |
container=True,
|
| 1599 |
bubble_full_width=False,
|
| 1600 |
avatar_images=[
|
|
@@ -1604,6 +1969,8 @@ with gr.Blocks(
|
|
| 1604 |
elem_id="albert_chat"
|
| 1605 |
)
|
| 1606 |
|
|
|
|
|
|
|
| 1607 |
# Typing indicator
|
| 1608 |
typing_indicator = gr.HTML(
|
| 1609 |
value="",
|
|
@@ -1745,16 +2112,23 @@ with gr.Blocks(
|
|
| 1745 |
with gr.TabItem("π Lesson Plan Generator"):
|
| 1746 |
with gr.Row():
|
| 1747 |
with gr.Column():
|
| 1748 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1749 |
subject = gr.Dropdown(
|
| 1750 |
choices=["Science", "Mathematics", "History", "English Language Arts", "Geography", "Art"],
|
| 1751 |
-
label="Subject",
|
| 1752 |
value="Science",
|
| 1753 |
interactive=True
|
| 1754 |
)
|
| 1755 |
grade_level = gr.Dropdown(
|
| 1756 |
choices=["K-2", "3-5", "6-8", "9-12"],
|
| 1757 |
-
label="Grade Level",
|
| 1758 |
value="6-8",
|
| 1759 |
interactive=True
|
| 1760 |
)
|
|
@@ -1763,22 +2137,38 @@ with gr.Blocks(
|
|
| 1763 |
maximum=180,
|
| 1764 |
step=15,
|
| 1765 |
value=60,
|
| 1766 |
-
label="Duration (minutes)"
|
| 1767 |
)
|
| 1768 |
difficulty = gr.Dropdown(
|
| 1769 |
choices=["Beginner", "Intermediate", "Advanced"],
|
| 1770 |
-
label="Difficulty",
|
| 1771 |
value="Intermediate",
|
| 1772 |
interactive=True
|
| 1773 |
)
|
| 1774 |
|
| 1775 |
-
generate_lesson_btn = gr.Button("Generate Lesson Plan", variant="primary")
|
|
|
|
|
|
|
| 1776 |
|
| 1777 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1778 |
progress_display = gr.HTML("", visible=False)
|
| 1779 |
-
lesson_plan_output = gr.Markdown(label="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1780 |
|
| 1781 |
-
# Example dataset
|
| 1782 |
gr.Dataset(
|
| 1783 |
components=[topic, subject, grade_level, duration, difficulty],
|
| 1784 |
samples=[
|
|
@@ -1787,6 +2177,8 @@ with gr.Blocks(
|
|
| 1787 |
["Basic Algebra", "Mathematics", "3-5", 45, "Beginner"]
|
| 1788 |
],
|
| 1789 |
)
|
|
|
|
|
|
|
| 1790 |
|
| 1791 |
# Event handler for lesson plan generation
|
| 1792 |
generate_lesson_btn.click(
|
|
@@ -1799,16 +2191,23 @@ with gr.Blocks(
|
|
| 1799 |
with gr.TabItem("π― Quiz Generator"):
|
| 1800 |
with gr.Row():
|
| 1801 |
with gr.Column():
|
| 1802 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1803 |
quiz_subject = gr.Dropdown(
|
| 1804 |
choices=["Science", "Mathematics", "History", "English Language Arts", "Geography", "Art"],
|
| 1805 |
-
label="Subject",
|
| 1806 |
value="Science",
|
| 1807 |
interactive=True
|
| 1808 |
)
|
| 1809 |
quiz_grade_level = gr.Dropdown(
|
| 1810 |
choices=["K-2", "3-5", "6-8", "9-12"],
|
| 1811 |
-
label="Grade Level",
|
| 1812 |
value="6-8",
|
| 1813 |
interactive=True
|
| 1814 |
)
|
|
@@ -1817,19 +2216,29 @@ with gr.Blocks(
|
|
| 1817 |
maximum=20,
|
| 1818 |
step=1,
|
| 1819 |
value=5,
|
| 1820 |
-
label="Number of Questions"
|
| 1821 |
)
|
| 1822 |
question_types = gr.CheckboxGroup(
|
| 1823 |
choices=["Multiple Choice", "True/False", "Short Answer", "Fill in the Blank"],
|
| 1824 |
-
label="Question Types",
|
| 1825 |
value=["Multiple Choice", "True/False"]
|
| 1826 |
)
|
| 1827 |
|
| 1828 |
-
generate_quiz_btn = gr.Button("Generate Quiz", variant="primary")
|
|
|
|
|
|
|
| 1829 |
|
| 1830 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1831 |
quiz_progress_display = gr.HTML(visible=False)
|
| 1832 |
-
quiz_output = gr.Markdown(label="
|
|
|
|
|
|
|
| 1833 |
|
| 1834 |
# Event handlers
|
| 1835 |
generate_quiz_btn.click(
|
|
|
|
| 1291 |
title="BrightMind AI - Educational Content Generator",
|
| 1292 |
theme=gr.themes.Soft(),
|
| 1293 |
css="""
|
| 1294 |
+
/* Modern UI Framework */
|
| 1295 |
+
.gradio-container {
|
| 1296 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 1297 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 1298 |
+
min-height: 100vh;
|
| 1299 |
+
}
|
| 1300 |
+
|
| 1301 |
+
/* Modern Card System */
|
| 1302 |
+
.modern-card {
|
| 1303 |
+
background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
|
| 1304 |
+
border-radius: 24px;
|
| 1305 |
+
padding: 32px;
|
| 1306 |
+
margin: 24px 0;
|
| 1307 |
+
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
|
| 1308 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 1309 |
+
backdrop-filter: blur(20px);
|
| 1310 |
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
| 1311 |
+
position: relative;
|
| 1312 |
+
overflow: hidden;
|
| 1313 |
+
}
|
| 1314 |
+
|
| 1315 |
+
.modern-card::before {
|
| 1316 |
+
content: '';
|
| 1317 |
+
position: absolute;
|
| 1318 |
+
top: 0;
|
| 1319 |
+
left: 0;
|
| 1320 |
+
right: 0;
|
| 1321 |
+
height: 4px;
|
| 1322 |
+
background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
|
| 1323 |
+
border-radius: 24px 24px 0 0;
|
| 1324 |
+
}
|
| 1325 |
+
|
| 1326 |
+
.modern-card:hover {
|
| 1327 |
+
transform: translateY(-8px) scale(1.02);
|
| 1328 |
+
box-shadow: 0 35px 70px rgba(0, 0, 0, 0.15);
|
| 1329 |
+
}
|
| 1330 |
+
|
| 1331 |
+
/* Enhanced Input Styling */
|
| 1332 |
+
.gradio-container input, .gradio-container textarea, .gradio-container select {
|
| 1333 |
+
border-radius: 16px !important;
|
| 1334 |
+
border: 2px solid #e2e8f0 !important;
|
| 1335 |
+
padding: 16px 20px !important;
|
| 1336 |
+
font-size: 15px !important;
|
| 1337 |
+
font-weight: 500 !important;
|
| 1338 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 1339 |
+
background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
|
| 1340 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
|
| 1341 |
+
}
|
| 1342 |
+
|
| 1343 |
+
.gradio-container input:focus, .gradio-container textarea:focus, .gradio-container select:focus {
|
| 1344 |
+
border-color: #667eea !important;
|
| 1345 |
+
box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(0, 0, 0, 0.1) !important;
|
| 1346 |
+
outline: none !important;
|
| 1347 |
+
transform: translateY(-2px) !important;
|
| 1348 |
+
}
|
| 1349 |
+
|
| 1350 |
+
/* Premium Button Design */
|
| 1351 |
+
.gradio-container .btn {
|
| 1352 |
+
border-radius: 16px !important;
|
| 1353 |
+
padding: 16px 32px !important;
|
| 1354 |
+
font-weight: 700 !important;
|
| 1355 |
+
font-size: 15px !important;
|
| 1356 |
+
text-transform: uppercase !important;
|
| 1357 |
+
letter-spacing: 0.5px !important;
|
| 1358 |
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 1359 |
+
border: none !important;
|
| 1360 |
+
position: relative !important;
|
| 1361 |
+
overflow: hidden !important;
|
| 1362 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 1363 |
+
color: white !important;
|
| 1364 |
+
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3) !important;
|
| 1365 |
+
}
|
| 1366 |
+
|
| 1367 |
+
.gradio-container .btn::before {
|
| 1368 |
+
content: '';
|
| 1369 |
+
position: absolute;
|
| 1370 |
+
top: 0;
|
| 1371 |
+
left: -100%;
|
| 1372 |
+
width: 100%;
|
| 1373 |
+
height: 100%;
|
| 1374 |
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
| 1375 |
+
transition: left 0.6s;
|
| 1376 |
+
}
|
| 1377 |
+
|
| 1378 |
+
.gradio-container .btn:hover::before {
|
| 1379 |
+
left: 100%;
|
| 1380 |
+
}
|
| 1381 |
+
|
| 1382 |
+
.gradio-container .btn:hover {
|
| 1383 |
+
transform: translateY(-4px) scale(1.05) !important;
|
| 1384 |
+
box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4) !important;
|
| 1385 |
+
}
|
| 1386 |
+
|
| 1387 |
+
.gradio-container .btn:active {
|
| 1388 |
+
transform: translateY(-2px) scale(1.02) !important;
|
| 1389 |
+
}
|
| 1390 |
+
|
| 1391 |
+
/* Modern Tab Navigation */
|
| 1392 |
+
.gradio-container .tab-nav {
|
| 1393 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 1394 |
+
border-radius: 20px !important;
|
| 1395 |
+
padding: 12px !important;
|
| 1396 |
+
margin-bottom: 32px !important;
|
| 1397 |
+
box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3) !important;
|
| 1398 |
+
backdrop-filter: blur(20px) !important;
|
| 1399 |
+
}
|
| 1400 |
+
|
| 1401 |
+
.gradio-container .tab-nav button {
|
| 1402 |
+
border-radius: 16px !important;
|
| 1403 |
+
padding: 16px 24px !important;
|
| 1404 |
+
font-weight: 700 !important;
|
| 1405 |
+
font-size: 15px !important;
|
| 1406 |
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 1407 |
+
border: none !important;
|
| 1408 |
+
background: transparent !important;
|
| 1409 |
+
color: rgba(255, 255, 255, 0.8) !important;
|
| 1410 |
+
position: relative !important;
|
| 1411 |
+
overflow: hidden !important;
|
| 1412 |
+
}
|
| 1413 |
+
|
| 1414 |
+
.gradio-container .tab-nav button::before {
|
| 1415 |
+
content: '';
|
| 1416 |
+
position: absolute;
|
| 1417 |
+
top: 0;
|
| 1418 |
+
left: 0;
|
| 1419 |
+
right: 0;
|
| 1420 |
+
bottom: 0;
|
| 1421 |
+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
|
| 1422 |
+
opacity: 0;
|
| 1423 |
+
transition: opacity 0.3s ease;
|
| 1424 |
+
}
|
| 1425 |
+
|
| 1426 |
+
.gradio-container .tab-nav button:hover::before {
|
| 1427 |
+
opacity: 1;
|
| 1428 |
+
}
|
| 1429 |
+
|
| 1430 |
+
.gradio-container .tab-nav button.selected {
|
| 1431 |
+
background: rgba(255, 255, 255, 0.2) !important;
|
| 1432 |
+
color: white !important;
|
| 1433 |
+
backdrop-filter: blur(20px) !important;
|
| 1434 |
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
|
| 1435 |
+
}
|
| 1436 |
+
|
| 1437 |
+
.gradio-container .tab-nav button:hover {
|
| 1438 |
+
color: white !important;
|
| 1439 |
+
transform: translateY(-2px) !important;
|
| 1440 |
+
}
|
| 1441 |
+
|
| 1442 |
+
/* Enhanced Chat Interface */
|
| 1443 |
+
.gradio-container .chatbot {
|
| 1444 |
+
border-radius: 24px !important;
|
| 1445 |
+
border: 2px solid #e2e8f0 !important;
|
| 1446 |
+
background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
|
| 1447 |
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1) !important;
|
| 1448 |
+
backdrop-filter: blur(20px) !important;
|
| 1449 |
+
overflow: hidden !important;
|
| 1450 |
+
}
|
| 1451 |
+
|
| 1452 |
+
.gradio-container .chatbot .message {
|
| 1453 |
+
border-radius: 20px !important;
|
| 1454 |
+
margin: 16px 0 !important;
|
| 1455 |
+
padding: 20px 24px !important;
|
| 1456 |
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
|
| 1457 |
+
transition: all 0.3s ease !important;
|
| 1458 |
+
}
|
| 1459 |
+
|
| 1460 |
+
.gradio-container .chatbot .message:hover {
|
| 1461 |
+
transform: translateX(4px) !important;
|
| 1462 |
+
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12) !important;
|
| 1463 |
+
}
|
| 1464 |
+
|
| 1465 |
+
/* Modern Progress System */
|
| 1466 |
+
.progress-container {
|
| 1467 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 1468 |
+
border-radius: 24px;
|
| 1469 |
+
padding: 40px;
|
| 1470 |
+
margin: 32px 0;
|
| 1471 |
+
color: white;
|
| 1472 |
+
text-align: center;
|
| 1473 |
+
box-shadow: 0 25px 50px rgba(102, 126, 234, 0.3);
|
| 1474 |
+
backdrop-filter: blur(20px);
|
| 1475 |
+
position: relative;
|
| 1476 |
+
overflow: hidden;
|
| 1477 |
+
}
|
| 1478 |
+
|
| 1479 |
+
.progress-container::before {
|
| 1480 |
+
content: '';
|
| 1481 |
+
position: absolute;
|
| 1482 |
+
top: -50%;
|
| 1483 |
+
left: -50%;
|
| 1484 |
+
width: 200%;
|
| 1485 |
+
height: 200%;
|
| 1486 |
+
background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
|
| 1487 |
+
animation: rotate 20s linear infinite;
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
@keyframes rotate {
|
| 1491 |
+
0% { transform: rotate(0deg); }
|
| 1492 |
+
100% { transform: rotate(360deg); }
|
| 1493 |
+
}
|
| 1494 |
+
|
| 1495 |
+
.progress-bar {
|
| 1496 |
+
width: 100%;
|
| 1497 |
+
height: 16px;
|
| 1498 |
+
background: rgba(255, 255, 255, 0.2);
|
| 1499 |
+
border-radius: 8px;
|
| 1500 |
+
overflow: hidden;
|
| 1501 |
+
margin: 24px 0;
|
| 1502 |
+
position: relative;
|
| 1503 |
+
}
|
| 1504 |
+
|
| 1505 |
+
.progress-fill {
|
| 1506 |
+
height: 100%;
|
| 1507 |
+
background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
|
| 1508 |
+
border-radius: 8px;
|
| 1509 |
+
animation: progress-animation 2s ease-in-out;
|
| 1510 |
+
position: relative;
|
| 1511 |
+
}
|
| 1512 |
+
|
| 1513 |
+
.progress-fill::after {
|
| 1514 |
+
content: '';
|
| 1515 |
+
position: absolute;
|
| 1516 |
+
top: 0;
|
| 1517 |
+
left: 0;
|
| 1518 |
+
right: 0;
|
| 1519 |
+
bottom: 0;
|
| 1520 |
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
| 1521 |
+
animation: shimmer 2s infinite;
|
| 1522 |
+
}
|
| 1523 |
+
|
| 1524 |
+
@keyframes shimmer {
|
| 1525 |
+
0% { transform: translateX(-100%); }
|
| 1526 |
+
100% { transform: translateX(100%); }
|
| 1527 |
+
}
|
| 1528 |
+
|
| 1529 |
+
@keyframes progress-animation {
|
| 1530 |
+
0% { width: 0%; }
|
| 1531 |
+
100% { width: 100%; }
|
| 1532 |
+
}
|
| 1533 |
+
|
| 1534 |
+
.status-text {
|
| 1535 |
+
font-size: 20px;
|
| 1536 |
+
font-weight: 700;
|
| 1537 |
+
margin: 20px 0;
|
| 1538 |
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
| 1539 |
+
}
|
| 1540 |
+
|
| 1541 |
+
.step-text {
|
| 1542 |
+
font-size: 18px;
|
| 1543 |
+
opacity: 0.9;
|
| 1544 |
+
margin: 12px 0;
|
| 1545 |
+
font-weight: 500;
|
| 1546 |
+
}
|
| 1547 |
+
|
| 1548 |
+
/* Modern Header Design */
|
| 1549 |
+
.modern-header {
|
| 1550 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 1551 |
+
border-radius: 24px;
|
| 1552 |
+
padding: 50px;
|
| 1553 |
+
margin: 32px 0;
|
| 1554 |
+
text-align: center;
|
| 1555 |
+
color: white;
|
| 1556 |
+
box-shadow: 0 25px 50px rgba(102, 126, 234, 0.3);
|
| 1557 |
+
position: relative;
|
| 1558 |
+
overflow: hidden;
|
| 1559 |
+
}
|
| 1560 |
+
|
| 1561 |
+
.modern-header::before {
|
| 1562 |
+
content: '';
|
| 1563 |
+
position: absolute;
|
| 1564 |
+
top: -50%;
|
| 1565 |
+
left: -50%;
|
| 1566 |
+
width: 200%;
|
| 1567 |
+
height: 200%;
|
| 1568 |
+
background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
|
| 1569 |
+
animation: float 6s ease-in-out infinite;
|
| 1570 |
+
}
|
| 1571 |
+
|
| 1572 |
+
@keyframes float {
|
| 1573 |
+
0%, 100% { transform: translateY(0px) rotate(0deg); }
|
| 1574 |
+
50% { transform: translateY(-20px) rotate(180deg); }
|
| 1575 |
+
}
|
| 1576 |
+
|
| 1577 |
+
.modern-header h1 {
|
| 1578 |
+
font-size: 3rem;
|
| 1579 |
+
font-weight: 800;
|
| 1580 |
+
margin: 0 0 16px 0;
|
| 1581 |
+
text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
| 1582 |
+
position: relative;
|
| 1583 |
+
z-index: 1;
|
| 1584 |
+
}
|
| 1585 |
+
|
| 1586 |
+
.modern-header p {
|
| 1587 |
+
font-size: 1.4rem;
|
| 1588 |
+
opacity: 0.9;
|
| 1589 |
+
margin: 0;
|
| 1590 |
+
position: relative;
|
| 1591 |
+
z-index: 1;
|
| 1592 |
+
font-weight: 500;
|
| 1593 |
+
}
|
| 1594 |
+
|
| 1595 |
+
/* Animation Classes */
|
| 1596 |
+
.fade-in {
|
| 1597 |
+
animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
|
| 1598 |
+
}
|
| 1599 |
+
|
| 1600 |
+
@keyframes fadeIn {
|
| 1601 |
+
from { opacity: 0; transform: translateY(30px); }
|
| 1602 |
+
to { opacity: 1; transform: translateY(0); }
|
| 1603 |
+
}
|
| 1604 |
+
|
| 1605 |
+
.slide-in-left {
|
| 1606 |
+
animation: slideInLeft 1s cubic-bezier(0.4, 0, 0.2, 1);
|
| 1607 |
+
}
|
| 1608 |
+
|
| 1609 |
+
@keyframes slideInLeft {
|
| 1610 |
+
from { transform: translateX(-100%); opacity: 0; }
|
| 1611 |
+
to { transform: translateX(0); opacity: 1; }
|
| 1612 |
+
}
|
| 1613 |
+
|
| 1614 |
+
.slide-in-right {
|
| 1615 |
+
animation: slideInRight 1s cubic-bezier(0.4, 0, 0.2, 1);
|
| 1616 |
+
}
|
| 1617 |
+
|
| 1618 |
+
@keyframes slideInRight {
|
| 1619 |
+
from { transform: translateX(100%); opacity: 0; }
|
| 1620 |
+
to { transform: translateX(0); opacity: 1; }
|
| 1621 |
+
}
|
| 1622 |
+
|
| 1623 |
+
.bounce-in {
|
| 1624 |
+
animation: bounceIn 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
| 1625 |
+
}
|
| 1626 |
+
|
| 1627 |
+
@keyframes bounceIn {
|
| 1628 |
+
0% { transform: scale(0.3); opacity: 0; }
|
| 1629 |
+
50% { transform: scale(1.05); }
|
| 1630 |
+
70% { transform: scale(0.9); }
|
| 1631 |
+
100% { transform: scale(1); opacity: 1; }
|
| 1632 |
+
}
|
| 1633 |
+
|
| 1634 |
+
/* Legacy Progress Container */
|
| 1635 |
.progress-container {
|
| 1636 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 1637 |
border-radius: 15px;
|
|
|
|
| 1877 |
"""
|
| 1878 |
) as demo:
|
| 1879 |
|
| 1880 |
+
# Modern Header
|
| 1881 |
with gr.Row():
|
| 1882 |
gr.HTML("""
|
| 1883 |
+
<div class="modern-header fade-in">
|
| 1884 |
<h1>π§ BrightMind AI</h1>
|
| 1885 |
<p>Professional Educational Content Generator for Teachers</p>
|
| 1886 |
</div>
|
|
|
|
| 1890 |
with gr.TabItem("π§ Ask Albert"):
|
| 1891 |
with gr.Row():
|
| 1892 |
with gr.Column(scale=1):
|
| 1893 |
+
gr.HTML("""
|
| 1894 |
+
<div class="modern-card slide-in-left">
|
| 1895 |
+
<h2 style="color: #667eea; margin-bottom: 16px; font-size: 1.8rem;">π§ Meet Albert!</h2>
|
| 1896 |
+
<p style="color: #4a5568; font-size: 1.1rem; margin-bottom: 20px;">Your friendly learning buddy! π</p>
|
| 1897 |
+
<div style="background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%); padding: 20px; border-radius: 16px; border-left: 4px solid #667eea;">
|
| 1898 |
+
<p style="margin: 0; color: #2d3748; font-weight: 600;">β¨ Tell Albert your name & age β Ask any question β Get fun explanations!</p>
|
| 1899 |
+
</div>
|
| 1900 |
+
</div>
|
| 1901 |
+
""")
|
| 1902 |
|
| 1903 |
+
# Modern Form Section
|
| 1904 |
+
gr.HTML("""
|
| 1905 |
+
<div class="modern-card slide-in-left">
|
| 1906 |
+
<h3 style="color: #667eea; margin-bottom: 20px; font-size: 1.4rem;">π€ User Setup</h3>
|
| 1907 |
""")
|
| 1908 |
|
|
|
|
| 1909 |
user_name = gr.Textbox(
|
| 1910 |
label="π What's your name?",
|
| 1911 |
placeholder="Enter your name here...",
|
|
|
|
| 1918 |
value="6-8"
|
| 1919 |
)
|
| 1920 |
|
| 1921 |
+
gr.HTML("</div>")
|
| 1922 |
+
|
| 1923 |
+
# Modern Chat Interface
|
| 1924 |
+
gr.HTML("""
|
| 1925 |
+
<div class="modern-card slide-in-left">
|
| 1926 |
+
<h3 style="color: #667eea; margin-bottom: 20px; font-size: 1.4rem;">π¬ Chat Interface</h3>
|
| 1927 |
+
""")
|
| 1928 |
|
|
|
|
| 1929 |
chat_input = gr.Textbox(
|
| 1930 |
+
label="Ask Albert anything!",
|
| 1931 |
placeholder="Type your question here...",
|
| 1932 |
+
lines=2
|
| 1933 |
)
|
| 1934 |
|
| 1935 |
with gr.Row():
|
| 1936 |
+
send_btn = gr.Button("π Send Message", variant="primary")
|
| 1937 |
+
clear_btn = gr.Button("ποΈ Clear Chat", variant="secondary")
|
| 1938 |
+
|
| 1939 |
+
gr.HTML("</div>")
|
| 1940 |
|
| 1941 |
|
| 1942 |
with gr.Column(scale=2):
|
| 1943 |
+
# Modern Albert Section
|
| 1944 |
+
gr.HTML("""
|
| 1945 |
+
<div class="modern-card slide-in-right bounce-in">
|
| 1946 |
+
<div style="text-align: center; padding: 20px;">
|
| 1947 |
+
<div style="font-size: 100px; margin-bottom: 20px; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.2));">π¨βπ«</div>
|
| 1948 |
+
<h3 style="color: #667eea; margin: 0; font-size: 1.5rem;">Albert is ready to help!</h3>
|
| 1949 |
+
</div>
|
| 1950 |
</div>
|
| 1951 |
""")
|
| 1952 |
|
| 1953 |
+
# Modern Chat Display
|
| 1954 |
+
gr.HTML("""
|
| 1955 |
+
<div class="modern-card slide-in-right">
|
| 1956 |
+
<h3 style="color: #667eea; margin-bottom: 20px; font-size: 1.4rem;">π¬ Albert's Chat</h3>
|
| 1957 |
+
""")
|
| 1958 |
+
|
| 1959 |
chat_display = gr.Chatbot(
|
| 1960 |
+
label="",
|
| 1961 |
+
height=400,
|
| 1962 |
+
show_label=False,
|
| 1963 |
container=True,
|
| 1964 |
bubble_full_width=False,
|
| 1965 |
avatar_images=[
|
|
|
|
| 1969 |
elem_id="albert_chat"
|
| 1970 |
)
|
| 1971 |
|
| 1972 |
+
gr.HTML("</div>")
|
| 1973 |
+
|
| 1974 |
# Typing indicator
|
| 1975 |
typing_indicator = gr.HTML(
|
| 1976 |
value="",
|
|
|
|
| 2112 |
with gr.TabItem("π Lesson Plan Generator"):
|
| 2113 |
with gr.Row():
|
| 2114 |
with gr.Column():
|
| 2115 |
+
# Modern Form Section
|
| 2116 |
+
gr.HTML("""
|
| 2117 |
+
<div class="modern-card slide-in-left">
|
| 2118 |
+
<h2 style="color: #667eea; margin-bottom: 20px; font-size: 1.8rem;">π Lesson Plan Generator</h2>
|
| 2119 |
+
<p style="color: #4a5568; font-size: 1.1rem; margin-bottom: 20px;">Create comprehensive lesson plans with AI assistance</p>
|
| 2120 |
+
""")
|
| 2121 |
+
|
| 2122 |
+
topic = gr.Textbox(label="π Topic", placeholder="e.g., Photosynthesis, World War II, Algebra")
|
| 2123 |
subject = gr.Dropdown(
|
| 2124 |
choices=["Science", "Mathematics", "History", "English Language Arts", "Geography", "Art"],
|
| 2125 |
+
label="π Subject",
|
| 2126 |
value="Science",
|
| 2127 |
interactive=True
|
| 2128 |
)
|
| 2129 |
grade_level = gr.Dropdown(
|
| 2130 |
choices=["K-2", "3-5", "6-8", "9-12"],
|
| 2131 |
+
label="π Grade Level",
|
| 2132 |
value="6-8",
|
| 2133 |
interactive=True
|
| 2134 |
)
|
|
|
|
| 2137 |
maximum=180,
|
| 2138 |
step=15,
|
| 2139 |
value=60,
|
| 2140 |
+
label="β±οΈ Duration (minutes)"
|
| 2141 |
)
|
| 2142 |
difficulty = gr.Dropdown(
|
| 2143 |
choices=["Beginner", "Intermediate", "Advanced"],
|
| 2144 |
+
label="π― Difficulty",
|
| 2145 |
value="Intermediate",
|
| 2146 |
interactive=True
|
| 2147 |
)
|
| 2148 |
|
| 2149 |
+
generate_lesson_btn = gr.Button("π Generate Lesson Plan", variant="primary")
|
| 2150 |
+
|
| 2151 |
+
gr.HTML("</div>")
|
| 2152 |
|
| 2153 |
with gr.Column():
|
| 2154 |
+
# Modern Output Section
|
| 2155 |
+
gr.HTML("""
|
| 2156 |
+
<div class="modern-card slide-in-right">
|
| 2157 |
+
<h3 style="color: #667eea; margin-bottom: 20px; font-size: 1.4rem;">π Generated Lesson Plan</h3>
|
| 2158 |
+
""")
|
| 2159 |
+
|
| 2160 |
progress_display = gr.HTML("", visible=False)
|
| 2161 |
+
lesson_plan_output = gr.Markdown(label="")
|
| 2162 |
+
|
| 2163 |
+
gr.HTML("</div>")
|
| 2164 |
+
|
| 2165 |
+
# Modern Examples Section
|
| 2166 |
+
gr.HTML("""
|
| 2167 |
+
<div class="modern-card slide-in-right">
|
| 2168 |
+
<h3 style="color: #667eea; margin-bottom: 20px; font-size: 1.4rem;">π‘ Example Topics</h3>
|
| 2169 |
+
<p style="color: #4a5568; margin-bottom: 15px;">Click on any example to get started quickly!</p>
|
| 2170 |
+
""")
|
| 2171 |
|
|
|
|
| 2172 |
gr.Dataset(
|
| 2173 |
components=[topic, subject, grade_level, duration, difficulty],
|
| 2174 |
samples=[
|
|
|
|
| 2177 |
["Basic Algebra", "Mathematics", "3-5", 45, "Beginner"]
|
| 2178 |
],
|
| 2179 |
)
|
| 2180 |
+
|
| 2181 |
+
gr.HTML("</div>")
|
| 2182 |
|
| 2183 |
# Event handler for lesson plan generation
|
| 2184 |
generate_lesson_btn.click(
|
|
|
|
| 2191 |
with gr.TabItem("π― Quiz Generator"):
|
| 2192 |
with gr.Row():
|
| 2193 |
with gr.Column():
|
| 2194 |
+
# Modern Form Section
|
| 2195 |
+
gr.HTML("""
|
| 2196 |
+
<div class="modern-card slide-in-left">
|
| 2197 |
+
<h2 style="color: #667eea; margin-bottom: 20px; font-size: 1.8rem;">π― Quiz Generator</h2>
|
| 2198 |
+
<p style="color: #4a5568; font-size: 1.1rem; margin-bottom: 20px;">Create engaging quizzes with multiple question types</p>
|
| 2199 |
+
""")
|
| 2200 |
+
|
| 2201 |
+
quiz_topic = gr.Textbox(label="π Quiz Topic", placeholder="e.g., Photosynthesis, World War II, Algebra")
|
| 2202 |
quiz_subject = gr.Dropdown(
|
| 2203 |
choices=["Science", "Mathematics", "History", "English Language Arts", "Geography", "Art"],
|
| 2204 |
+
label="π Subject",
|
| 2205 |
value="Science",
|
| 2206 |
interactive=True
|
| 2207 |
)
|
| 2208 |
quiz_grade_level = gr.Dropdown(
|
| 2209 |
choices=["K-2", "3-5", "6-8", "9-12"],
|
| 2210 |
+
label="π Grade Level",
|
| 2211 |
value="6-8",
|
| 2212 |
interactive=True
|
| 2213 |
)
|
|
|
|
| 2216 |
maximum=20,
|
| 2217 |
step=1,
|
| 2218 |
value=5,
|
| 2219 |
+
label="β Number of Questions"
|
| 2220 |
)
|
| 2221 |
question_types = gr.CheckboxGroup(
|
| 2222 |
choices=["Multiple Choice", "True/False", "Short Answer", "Fill in the Blank"],
|
| 2223 |
+
label="π Question Types",
|
| 2224 |
value=["Multiple Choice", "True/False"]
|
| 2225 |
)
|
| 2226 |
|
| 2227 |
+
generate_quiz_btn = gr.Button("π Generate Quiz", variant="primary")
|
| 2228 |
+
|
| 2229 |
+
gr.HTML("</div>")
|
| 2230 |
|
| 2231 |
with gr.Column():
|
| 2232 |
+
# Modern Output Section
|
| 2233 |
+
gr.HTML("""
|
| 2234 |
+
<div class="modern-card slide-in-right">
|
| 2235 |
+
<h3 style="color: #667eea; margin-bottom: 20px; font-size: 1.4rem;">π Generated Quiz</h3>
|
| 2236 |
+
""")
|
| 2237 |
+
|
| 2238 |
quiz_progress_display = gr.HTML(visible=False)
|
| 2239 |
+
quiz_output = gr.Markdown(label="")
|
| 2240 |
+
|
| 2241 |
+
gr.HTML("</div>")
|
| 2242 |
|
| 2243 |
# Event handlers
|
| 2244 |
generate_quiz_btn.click(
|