Spaces:
Sleeping
Sleeping
Mahdi Naser Moghadasi commited on
Commit ·
2d2f7cb
1
Parent(s): 479fbb0
Simplify Albert: Remove all styling, keep only simple emoji
Browse files
app.py
CHANGED
|
@@ -1587,140 +1587,10 @@ with gr.Blocks(
|
|
| 1587 |
""")
|
| 1588 |
|
| 1589 |
with gr.Column(scale=2):
|
| 1590 |
-
#
|
| 1591 |
albert_image_frame = gr.HTML("""
|
| 1592 |
-
<div
|
| 1593 |
-
|
| 1594 |
-
border-radius: 20px;
|
| 1595 |
-
padding: 20px;
|
| 1596 |
-
margin: 10px 0;
|
| 1597 |
-
text-align: center;
|
| 1598 |
-
box-shadow: 0 8px 32px rgba(79, 172, 254, 0.3);
|
| 1599 |
-
border: 3px solid #fff;
|
| 1600 |
-
position: relative;
|
| 1601 |
-
overflow: hidden;
|
| 1602 |
-
">
|
| 1603 |
-
<h3 style="color: white; margin-bottom: 15px; font-size: 20px; font-weight: bold;">🧠 Albert</h3>
|
| 1604 |
-
|
| 1605 |
-
<!-- Animated Albert Avatar -->
|
| 1606 |
-
<div id="albert-avatar" style="
|
| 1607 |
-
width: 100px;
|
| 1608 |
-
height: 100px;
|
| 1609 |
-
background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
|
| 1610 |
-
border-radius: 50%;
|
| 1611 |
-
margin: 0 auto 15px;
|
| 1612 |
-
display: flex;
|
| 1613 |
-
align-items: center;
|
| 1614 |
-
justify-content: center;
|
| 1615 |
-
font-size: 50px;
|
| 1616 |
-
box-shadow: 0 8px 25px rgba(0,0,0,0.2);
|
| 1617 |
-
transition: all 0.3s ease;
|
| 1618 |
-
position: relative;
|
| 1619 |
-
">
|
| 1620 |
-
<div id="albert-face" style="
|
| 1621 |
-
font-size: 50px;
|
| 1622 |
-
transition: all 0.2s ease;
|
| 1623 |
-
">👨🏫</div>
|
| 1624 |
-
</div>
|
| 1625 |
-
|
| 1626 |
-
<!-- Speech bubbles animation -->
|
| 1627 |
-
<div id="speech-bubbles" style="
|
| 1628 |
-
position: absolute;
|
| 1629 |
-
top: 20px;
|
| 1630 |
-
right: 20px;
|
| 1631 |
-
opacity: 0;
|
| 1632 |
-
transition: opacity 0.3s ease;
|
| 1633 |
-
">
|
| 1634 |
-
<div style="
|
| 1635 |
-
width: 8px;
|
| 1636 |
-
height: 8px;
|
| 1637 |
-
background: white;
|
| 1638 |
-
border-radius: 50%;
|
| 1639 |
-
margin: 2px;
|
| 1640 |
-
display: inline-block;
|
| 1641 |
-
animation: speech-bubble 1.5s infinite;
|
| 1642 |
-
"></div>
|
| 1643 |
-
<div style="
|
| 1644 |
-
width: 8px;
|
| 1645 |
-
height: 8px;
|
| 1646 |
-
background: white;
|
| 1647 |
-
border-radius: 50%;
|
| 1648 |
-
margin: 2px;
|
| 1649 |
-
display: inline-block;
|
| 1650 |
-
animation: speech-bubble 1.5s infinite 0.2s;
|
| 1651 |
-
"></div>
|
| 1652 |
-
<div style="
|
| 1653 |
-
width: 8px;
|
| 1654 |
-
height: 8px;
|
| 1655 |
-
background: white;
|
| 1656 |
-
border-radius: 50%;
|
| 1657 |
-
margin: 2px;
|
| 1658 |
-
display: inline-block;
|
| 1659 |
-
animation: speech-bubble 1.5s infinite 0.4s;
|
| 1660 |
-
"></div>
|
| 1661 |
-
</div>
|
| 1662 |
-
|
| 1663 |
-
<p id="albert-status" style="color: white; font-size: 14px; margin: 0; font-weight: 500;">
|
| 1664 |
-
Ready to help! ✨
|
| 1665 |
-
</p>
|
| 1666 |
-
|
| 1667 |
-
<style>
|
| 1668 |
-
@keyframes speech-bubble {
|
| 1669 |
-
0%, 60%, 100% {
|
| 1670 |
-
transform: scale(1);
|
| 1671 |
-
opacity: 0.7;
|
| 1672 |
-
}
|
| 1673 |
-
30% {
|
| 1674 |
-
transform: scale(1.3);
|
| 1675 |
-
opacity: 1;
|
| 1676 |
-
}
|
| 1677 |
-
}
|
| 1678 |
-
|
| 1679 |
-
@keyframes talking {
|
| 1680 |
-
0%, 100% {
|
| 1681 |
-
transform: scale(1) rotate(0deg);
|
| 1682 |
-
}
|
| 1683 |
-
25% {
|
| 1684 |
-
transform: scale(1.15) rotate(3deg);
|
| 1685 |
-
}
|
| 1686 |
-
75% {
|
| 1687 |
-
transform: scale(1.15) rotate(-3deg);
|
| 1688 |
-
}
|
| 1689 |
-
}
|
| 1690 |
-
|
| 1691 |
-
@keyframes thinking {
|
| 1692 |
-
0%, 100% {
|
| 1693 |
-
transform: scale(1);
|
| 1694 |
-
}
|
| 1695 |
-
50% {
|
| 1696 |
-
transform: scale(1.2);
|
| 1697 |
-
}
|
| 1698 |
-
}
|
| 1699 |
-
|
| 1700 |
-
.albert-talking {
|
| 1701 |
-
animation: talking 0.5s infinite;
|
| 1702 |
-
background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4) !important;
|
| 1703 |
-
background-size: 400% 400% !important;
|
| 1704 |
-
animation: talking 0.5s infinite, gradient-shift 2s ease infinite !important;
|
| 1705 |
-
}
|
| 1706 |
-
|
| 1707 |
-
.albert-thinking {
|
| 1708 |
-
animation: thinking 1s infinite;
|
| 1709 |
-
background: linear-gradient(45deg, #ff9a9e, #fecfef, #fecfef, #ff9a9e) !important;
|
| 1710 |
-
background-size: 400% 400% !important;
|
| 1711 |
-
animation: thinking 1s infinite, gradient-shift 3s ease infinite !important;
|
| 1712 |
-
}
|
| 1713 |
-
|
| 1714 |
-
@keyframes gradient-shift {
|
| 1715 |
-
0% { background-position: 0% 50%; }
|
| 1716 |
-
50% { background-position: 100% 50%; }
|
| 1717 |
-
100% { background-position: 0% 50%; }
|
| 1718 |
-
}
|
| 1719 |
-
|
| 1720 |
-
.speech-visible {
|
| 1721 |
-
opacity: 1 !important;
|
| 1722 |
-
}
|
| 1723 |
-
</style>
|
| 1724 |
</div>
|
| 1725 |
""")
|
| 1726 |
|
|
@@ -1787,22 +1657,6 @@ with gr.Blocks(
|
|
| 1787 |
30% { opacity: 1; }
|
| 1788 |
}
|
| 1789 |
</style>
|
| 1790 |
-
<script>
|
| 1791 |
-
// Start Albert thinking animation
|
| 1792 |
-
function startAlbertThinking() {
|
| 1793 |
-
const avatar = document.getElementById('albert-avatar');
|
| 1794 |
-
const face = document.getElementById('albert-face');
|
| 1795 |
-
const status = document.getElementById('albert-status');
|
| 1796 |
-
|
| 1797 |
-
if (avatar && face && status) {
|
| 1798 |
-
avatar.classList.add('albert-thinking');
|
| 1799 |
-
face.textContent = '👨🏫';
|
| 1800 |
-
status.textContent = 'Thinking... 💭';
|
| 1801 |
-
}
|
| 1802 |
-
}
|
| 1803 |
-
|
| 1804 |
-
startAlbertThinking();
|
| 1805 |
-
</script>
|
| 1806 |
"""
|
| 1807 |
|
| 1808 |
# Generate Albert's response with full context
|
|
@@ -1826,7 +1680,7 @@ with gr.Blocks(
|
|
| 1826 |
</div>
|
| 1827 |
"""
|
| 1828 |
|
| 1829 |
-
# Add auto-scroll trigger
|
| 1830 |
scroll_script = """
|
| 1831 |
<script>
|
| 1832 |
function forceScrollToBottom() {
|
|
@@ -1857,41 +1711,6 @@ with gr.Blocks(
|
|
| 1857 |
}
|
| 1858 |
}
|
| 1859 |
|
| 1860 |
-
// Albert animation functions
|
| 1861 |
-
function startAlbertTalking() {
|
| 1862 |
-
const avatar = document.getElementById('albert-avatar');
|
| 1863 |
-
const face = document.getElementById('albert-face');
|
| 1864 |
-
const bubbles = document.getElementById('speech-bubbles');
|
| 1865 |
-
const status = document.getElementById('albert-status');
|
| 1866 |
-
|
| 1867 |
-
if (avatar && face && bubbles && status) {
|
| 1868 |
-
avatar.classList.add('albert-talking');
|
| 1869 |
-
face.textContent = '👨🏫';
|
| 1870 |
-
bubbles.classList.add('speech-visible');
|
| 1871 |
-
status.textContent = 'Talking... 🗣️';
|
| 1872 |
-
}
|
| 1873 |
-
}
|
| 1874 |
-
|
| 1875 |
-
function stopAlbertTalking() {
|
| 1876 |
-
const avatar = document.getElementById('albert-avatar');
|
| 1877 |
-
const face = document.getElementById('albert-face');
|
| 1878 |
-
const bubbles = document.getElementById('speech-bubbles');
|
| 1879 |
-
const status = document.getElementById('albert-status');
|
| 1880 |
-
|
| 1881 |
-
if (avatar && face && bubbles && status) {
|
| 1882 |
-
avatar.classList.remove('albert-talking');
|
| 1883 |
-
face.textContent = '👨🏫';
|
| 1884 |
-
bubbles.classList.remove('speech-visible');
|
| 1885 |
-
status.textContent = 'Ready to help! ✨';
|
| 1886 |
-
}
|
| 1887 |
-
}
|
| 1888 |
-
|
| 1889 |
-
// Start Albert talking animation
|
| 1890 |
-
startAlbertTalking();
|
| 1891 |
-
|
| 1892 |
-
// Stop talking after response is complete
|
| 1893 |
-
setTimeout(stopAlbertTalking, 3000);
|
| 1894 |
-
|
| 1895 |
// Try scrolling multiple times to ensure it works
|
| 1896 |
setTimeout(forceScrollToBottom, 50);
|
| 1897 |
setTimeout(forceScrollToBottom, 200);
|
|
|
|
| 1587 |
""")
|
| 1588 |
|
| 1589 |
with gr.Column(scale=2):
|
| 1590 |
+
# Simple Albert emoji
|
| 1591 |
albert_image_frame = gr.HTML("""
|
| 1592 |
+
<div style="text-align: center; padding: 20px;">
|
| 1593 |
+
<div style="font-size: 80px;">👨🏫</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1594 |
</div>
|
| 1595 |
""")
|
| 1596 |
|
|
|
|
| 1657 |
30% { opacity: 1; }
|
| 1658 |
}
|
| 1659 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1660 |
"""
|
| 1661 |
|
| 1662 |
# Generate Albert's response with full context
|
|
|
|
| 1680 |
</div>
|
| 1681 |
"""
|
| 1682 |
|
| 1683 |
+
# Add auto-scroll trigger
|
| 1684 |
scroll_script = """
|
| 1685 |
<script>
|
| 1686 |
function forceScrollToBottom() {
|
|
|
|
| 1711 |
}
|
| 1712 |
}
|
| 1713 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1714 |
// Try scrolling multiple times to ensure it works
|
| 1715 |
setTimeout(forceScrollToBottom, 50);
|
| 1716 |
setTimeout(forceScrollToBottom, 200);
|