Upload app.py
Browse files
app.py
CHANGED
|
@@ -763,27 +763,18 @@ if not st.session_state.messages:
|
|
| 763 |
from { opacity:0; transform:translateY(24px); }
|
| 764 |
to { opacity:1; transform:translateY(0); }
|
| 765 |
}
|
| 766 |
-
@keyframes gradientShift {
|
| 767 |
-
0% { background-position: 0% 50%; }
|
| 768 |
-
50% { background-position: 100% 50%; }
|
| 769 |
-
100% { background-position: 0% 50%; }
|
| 770 |
-
}
|
| 771 |
@keyframes floatSymbol {
|
| 772 |
0%,100% { transform: translateY(0px) rotate(0deg); opacity:0.18; }
|
| 773 |
33% { transform: translateY(-8px) rotate(5deg); opacity:0.32; }
|
| 774 |
66% { transform: translateY(4px) rotate(-3deg); opacity:0.22; }
|
| 775 |
}
|
| 776 |
-
@keyframes spin {
|
| 777 |
-
from { transform: rotate(0deg); }
|
| 778 |
-
to { transform: rotate(360deg); }
|
| 779 |
-
}
|
| 780 |
.saad-welcome-wrap {
|
| 781 |
position: relative;
|
| 782 |
display: flex;
|
| 783 |
flex-direction: column;
|
| 784 |
align-items: center;
|
| 785 |
justify-content: center;
|
| 786 |
-
padding:
|
| 787 |
text-align: center;
|
| 788 |
animation: fadeInUp 0.7s cubic-bezier(.22,1,.36,1) both;
|
| 789 |
overflow: hidden;
|
|
@@ -810,12 +801,10 @@ if not st.session_state.messages:
|
|
| 810 |
font-size: 3rem;
|
| 811 |
font-weight: 800;
|
| 812 |
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 40%, #f472b6 70%, #60a5fa 100%);
|
| 813 |
-
background-size: 300% 300%;
|
| 814 |
-webkit-background-clip: text;
|
| 815 |
-webkit-text-fill-color: transparent;
|
| 816 |
background-clip: text;
|
| 817 |
-
|
| 818 |
-
letter-spacing: 1px;
|
| 819 |
margin-bottom: 0.5rem;
|
| 820 |
font-family: 'Inter', sans-serif;
|
| 821 |
}
|
|
@@ -830,14 +819,12 @@ if not st.session_state.messages:
|
|
| 830 |
border: 2px solid transparent;
|
| 831 |
background: linear-gradient(#0f0f0f, #0f0f0f) padding-box,
|
| 832 |
linear-gradient(135deg, #3b82f6, #a78bfa, #f472b6) border-box;
|
| 833 |
-
animation: spin 3s linear infinite;
|
| 834 |
display: flex;
|
| 835 |
align-items: center;
|
| 836 |
justify-content: center;
|
| 837 |
font-size: 1.5rem;
|
| 838 |
}
|
| 839 |
.math-ring-inner {
|
| 840 |
-
animation: spin 3s linear infinite reverse;
|
| 841 |
font-size: 1.4rem;
|
| 842 |
}
|
| 843 |
.saad-tagline {
|
|
@@ -874,28 +861,16 @@ if not st.session_state.messages:
|
|
| 874 |
<div class="saad-main-name">Saad.AI</div>
|
| 875 |
<!-- Tagline -->
|
| 876 |
<div class="saad-tagline">
|
| 877 |
-
|
| 878 |
-
<span>·</span>
|
| 879 |
-
<span>·</span>
|
| 880 |
-
|
|
|
|
|
|
|
| 881 |
</div>
|
| 882 |
</div>
|
| 883 |
""", unsafe_allow_html=True)
|
| 884 |
|
| 885 |
-
st.markdown("### Explore a worked example")
|
| 886 |
-
st.caption("Start with a guided problem, then try your own question. Supported calculations are verified by SymPy before the AI explanation is shown.")
|
| 887 |
-
demo_cols = st.columns(3)
|
| 888 |
-
demo_prompts = [
|
| 889 |
-
("📈 Calculus", "Find the derivative of x^3 + 5x^2 - 3x + 7"),
|
| 890 |
-
("🔢 Linear algebra", "Find eigenvalues of matrix [[4,1],[2,3]]"),
|
| 891 |
-
("🧮 Numerical", "Apply Newton-Raphson to x^3 - 2x - 5 = 0, x0=2, 3 iterations"),
|
| 892 |
-
]
|
| 893 |
-
for demo_col, (label, prompt) in zip(demo_cols, demo_prompts):
|
| 894 |
-
with demo_col:
|
| 895 |
-
if st.button(label, use_container_width=True, key=f"demo_{label}"):
|
| 896 |
-
st.session_state.demo_problem = prompt
|
| 897 |
-
st.rerun()
|
| 898 |
-
|
| 899 |
# Small corner header — only when chat has started
|
| 900 |
else:
|
| 901 |
st.markdown("""
|
|
@@ -1020,11 +995,7 @@ user_input = st.chat_input(
|
|
| 1020 |
placeholder="Type a math problem... or attach a file in the sidebar ← then ask here",
|
| 1021 |
)
|
| 1022 |
|
| 1023 |
-
|
| 1024 |
-
demo_problem = st.session_state.pop("demo_problem", "")
|
| 1025 |
-
if demo_problem and demo_problem != st.session_state.last_submitted:
|
| 1026 |
-
problem = demo_problem
|
| 1027 |
-
elif prefill and prefill != st.session_state.last_submitted:
|
| 1028 |
problem = prefill
|
| 1029 |
elif user_input and user_input.strip():
|
| 1030 |
problem = user_input.strip()
|
|
|
|
| 763 |
from { opacity:0; transform:translateY(24px); }
|
| 764 |
to { opacity:1; transform:translateY(0); }
|
| 765 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 766 |
@keyframes floatSymbol {
|
| 767 |
0%,100% { transform: translateY(0px) rotate(0deg); opacity:0.18; }
|
| 768 |
33% { transform: translateY(-8px) rotate(5deg); opacity:0.32; }
|
| 769 |
66% { transform: translateY(4px) rotate(-3deg); opacity:0.22; }
|
| 770 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 771 |
.saad-welcome-wrap {
|
| 772 |
position: relative;
|
| 773 |
display: flex;
|
| 774 |
flex-direction: column;
|
| 775 |
align-items: center;
|
| 776 |
justify-content: center;
|
| 777 |
+
padding: 3.8rem 1rem 2.4rem 1rem;
|
| 778 |
text-align: center;
|
| 779 |
animation: fadeInUp 0.7s cubic-bezier(.22,1,.36,1) both;
|
| 780 |
overflow: hidden;
|
|
|
|
| 801 |
font-size: 3rem;
|
| 802 |
font-weight: 800;
|
| 803 |
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 40%, #f472b6 70%, #60a5fa 100%);
|
|
|
|
| 804 |
-webkit-background-clip: text;
|
| 805 |
-webkit-text-fill-color: transparent;
|
| 806 |
background-clip: text;
|
| 807 |
+
letter-spacing: 0.5px;
|
|
|
|
| 808 |
margin-bottom: 0.5rem;
|
| 809 |
font-family: 'Inter', sans-serif;
|
| 810 |
}
|
|
|
|
| 819 |
border: 2px solid transparent;
|
| 820 |
background: linear-gradient(#0f0f0f, #0f0f0f) padding-box,
|
| 821 |
linear-gradient(135deg, #3b82f6, #a78bfa, #f472b6) border-box;
|
|
|
|
| 822 |
display: flex;
|
| 823 |
align-items: center;
|
| 824 |
justify-content: center;
|
| 825 |
font-size: 1.5rem;
|
| 826 |
}
|
| 827 |
.math-ring-inner {
|
|
|
|
| 828 |
font-size: 1.4rem;
|
| 829 |
}
|
| 830 |
.saad-tagline {
|
|
|
|
| 861 |
<div class="saad-main-name">Saad.AI</div>
|
| 862 |
<!-- Tagline -->
|
| 863 |
<div class="saad-tagline">
|
| 864 |
+
B.Sc. Mathematics Engine
|
| 865 |
+
<span>·</span> Verified by SymPy
|
| 866 |
+
<span>·</span> Explained by AI
|
| 867 |
+
</div>
|
| 868 |
+
<div class="saad-tagline" style="margin-top:0.85rem; color:#64748b;">
|
| 869 |
+
Ask a mathematical question to begin.
|
| 870 |
</div>
|
| 871 |
</div>
|
| 872 |
""", unsafe_allow_html=True)
|
| 873 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 874 |
# Small corner header — only when chat has started
|
| 875 |
else:
|
| 876 |
st.markdown("""
|
|
|
|
| 995 |
placeholder="Type a math problem... or attach a file in the sidebar ← then ask here",
|
| 996 |
)
|
| 997 |
|
| 998 |
+
if prefill and prefill != st.session_state.last_submitted:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 999 |
problem = prefill
|
| 1000 |
elif user_input and user_input.strip():
|
| 1001 |
problem = user_input.strip()
|