saad-sust commited on
Commit
1a44cc7
ยท
verified ยท
1 Parent(s): 6884b7d

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +196 -73
app.py CHANGED
@@ -36,7 +36,7 @@ st.set_page_config(
36
  # โ”€โ”€ CSS โ€” ChatGPT-style, compact font, clean dark theme โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
37
  st.markdown("""
38
  <style>
39
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
40
 
41
  /* โ”€โ”€ Base โ”€โ”€ */
42
  html, body, [class*="css"] {
@@ -54,36 +54,69 @@ html, body, [class*="css"] {
54
  /* โ”€โ”€ Header โ”€โ”€ */
55
  .saad-header {
56
  text-align: center;
57
- padding: 1.2rem 0 0.5rem 0;
58
  margin-bottom: 0.5rem;
59
  }
60
  .saad-header h1 {
61
- font-size: 1.5rem !important;
62
- font-weight: 600;
63
- color: #ffffff;
 
 
 
64
  margin: 0;
65
- letter-spacing: 0.5px;
66
  }
67
  .saad-header p {
68
- font-size: 0.78rem;
69
- color: #666;
70
- margin: 0.2rem 0 0 0;
 
71
  }
72
  .badge-row {
73
  display: flex;
74
  gap: 0.4rem;
75
  justify-content: center;
76
  flex-wrap: wrap;
77
- margin-top: 0.6rem;
78
  }
79
  .badge {
80
- background: #1a1a1a;
81
- border: 1px solid #2a2a2a;
82
- color: #888;
83
- padding: 2px 8px;
84
  border-radius: 20px;
85
  font-size: 0.68rem;
86
  font-family: 'JetBrains Mono', monospace;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
  /* โ”€โ”€ Chat messages โ€” override Streamlit defaults โ”€โ”€ */
@@ -101,7 +134,7 @@ html, body, [class*="css"] {
101
  }
102
  [data-testid="stChatMessage"]:has([data-testid="chatAvatarIcon-user"])
103
  [data-testid="stChatMessageContent"] {
104
- background: #1e3a5f !important;
105
  border: 1px solid #2a4a7f !important;
106
  border-radius: 18px 4px 18px 18px !important;
107
  padding: 0.6rem 0.9rem !important;
@@ -113,8 +146,8 @@ html, body, [class*="css"] {
113
  /* Assistant message */
114
  [data-testid="stChatMessage"]:has([data-testid="chatAvatarIcon-assistant"])
115
  [data-testid="stChatMessageContent"] {
116
- background: #1a1a1a !important;
117
- border: 1px solid #2a2a2a !important;
118
  border-radius: 4px 18px 18px 18px !important;
119
  padding: 0.7rem 1rem !important;
120
  font-size: 0.88rem !important;
@@ -124,11 +157,11 @@ html, body, [class*="css"] {
124
 
125
  /* Math display blocks */
126
  .katex-display {
127
- background: #161616 !important;
128
  border-left: 3px solid #3b82f6 !important;
129
- border-radius: 0 6px 6px 0 !important;
130
- padding: 0.5rem 1rem !important;
131
- margin: 0.4rem 0 !important;
132
  overflow-x: auto !important;
133
  }
134
  .katex { font-size: 1em !important; }
@@ -142,9 +175,9 @@ html, body, [class*="css"] {
142
 
143
  /* โ”€โ”€ Input box โ”€โ”€ */
144
  [data-testid="stChatInput"] {
145
- background: #1a1a1a !important;
146
- border: 1px solid #2a2a2a !important;
147
- border-radius: 12px !important;
148
  }
149
  [data-testid="stChatInput"] textarea {
150
  font-size: 0.88rem !important;
@@ -154,18 +187,53 @@ html, body, [class*="css"] {
154
 
155
  /* โ”€โ”€ Sidebar โ”€โ”€ */
156
  [data-testid="stSidebar"] {
157
- background: #0a0a0a !important;
158
- border-right: 1px solid #1a1a1a !important;
159
  }
160
  [data-testid="stSidebar"] * {
161
  font-size: 0.82rem !important;
162
  }
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  /* โ”€โ”€ Buttons โ”€โ”€ */
165
  .stButton > button {
166
- background: #1a1a1a !important;
167
- border: 1px solid #2a2a2a !important;
168
- color: #888 !important;
169
  border-radius: 8px !important;
170
  font-size: 0.78rem !important;
171
  padding: 0.3rem 0.8rem !important;
@@ -176,14 +244,14 @@ html, body, [class*="css"] {
176
  .stButton > button:hover {
177
  border-color: #3b82f6 !important;
178
  color: #ececec !important;
179
- background: #161b2e !important;
180
  }
181
 
182
- /* โ”€โ”€ Copy button โ€” Claude style โ”€โ”€ */
183
  [data-testid="stChatMessage"] .stButton > button {
184
  background: transparent !important;
185
- border: 1px solid #2a2a2a !important;
186
- color: #555 !important;
187
  border-radius: 6px !important;
188
  font-size: 0.75rem !important;
189
  padding: 2px 6px !important;
@@ -195,23 +263,34 @@ html, body, [class*="css"] {
195
  [data-testid="stChatMessage"] .stButton > button:hover {
196
  border-color: #3b82f6 !important;
197
  color: #ececec !important;
198
- background: #1a1f2e !important;
199
  }
200
 
201
- /* โ”€โ”€ Spinner โ”€โ”€ */
202
  .stSpinner > div { border-top-color: #3b82f6 !important; }
 
 
 
 
 
203
 
204
  /* โ”€โ”€ Divider โ”€โ”€ */
205
- hr { border-color: #1a1a1a !important; }
206
 
207
  /* โ”€โ”€ Selectbox โ”€โ”€ */
208
  .stSelectbox > div > div {
209
- background: #1a1a1a !important;
210
- border-color: #2a2a2a !important;
211
  color: #ececec !important;
212
  border-radius: 8px !important;
213
  font-size: 0.82rem !important;
214
  }
 
 
 
 
 
 
215
  </style>
216
  """, unsafe_allow_html=True)
217
 
@@ -1747,23 +1826,17 @@ def ask_ai(problem: str, sympy_info: dict, history: list) -> str:
1747
  " โ†’ Never skip this structure. Never merge steps. Never jump to answer without showing work.\n"
1748
  " โ†’ If user says plot/draw/graph/sketch/visualize: a real graph renders automatically.\n"
1749
  " Do NOT draw ASCII art. Do NOT say you cannot draw.\n"
1750
- " Give this response โ€” then graph renders below automatically:\n"
1751
  " ๐Ÿ“Œ **Function:** state f(x) clearly in LaTeX\n"
1752
  " ๐Ÿ” **Key Features:**\n"
1753
  " - Domain and range\n"
1754
- " - x-intercepts: solve f(x)=0 and state exact values\n"
1755
  " - y-intercept: f(0)\n"
1756
  " - Turning points / vertex if any\n"
1757
  " - Behavior as $x \\to \\pm\\infty$\n"
1758
- " โœ๏ธ **How to Draw (step by step):**\n"
1759
- " - Step 1: Mark the vertex or starting point on paper\n"
1760
- " - Step 2: Mark all x-intercepts on x-axis\n"
1761
- " - Step 3: Mark y-intercept on y-axis\n"
1762
- " - Step 4: Calculate and plot 3-4 extra points showing the shape\n"
1763
- " - Step 5: Connect all points smoothly with the correct curve shape\n"
1764
- " - Step 6: Add arrows at ends if function extends to infinity\n"
1765
- " โ†’ Give EXACT coordinates for every point. Student must be able to draw without a calculator.\n"
1766
- " ๐Ÿ“Š **Graph** is shown below for verification.\n\n"
1767
  "RULE 2 โ€” LATEX (zero exceptions):\n"
1768
  " - Inline math (inside a sentence): $expression$\n"
1769
  " - Display math (standalone line, centered): $$expression$$\n"
@@ -2071,14 +2144,21 @@ with st.sidebar:
2071
  st.divider()
2072
 
2073
  st.markdown("**๐ŸŽฏ Topics**")
2074
- topics = [
2075
- "๐Ÿ“ˆ Calculus", "๐Ÿ”ข Linear Algebra", "๐Ÿ” Number Theory",
2076
- "๐Ÿ“‰ Differential Equations", "๐Ÿงฎ Numerical Methods",
2077
- "๐Ÿ“ Differential Geometry", "๐ŸŒŠ Hydro Mechanics",
2078
- "๐Ÿ” Theory of Numbers", "๐Ÿ“Š Real Analysis II", "โž• General Math"
2079
- ]
2080
- for t in topics:
2081
- st.caption(t)
 
 
 
 
 
 
 
2082
 
2083
  st.divider()
2084
  st.markdown("**โšก Example Problems**")
@@ -2106,9 +2186,14 @@ with st.sidebar:
2106
 
2107
  st.divider()
2108
  st.markdown("**๐Ÿ”ง Engine**")
2109
- st.caption("๐Ÿค– Groq Llama 3.3 70B โ€” reasoning")
2110
- st.caption("๐Ÿงฎ SymPy โ€” verified computation")
2111
- st.caption("โœ… Zero arithmetic errors")
 
 
 
 
 
2112
 
2113
  st.divider()
2114
  if st.button("๐Ÿ—‘๏ธ Clear Chat", use_container_width=True):
@@ -2125,12 +2210,13 @@ with st.sidebar:
2125
  st.markdown("""
2126
  <div class="saad-header">
2127
  <h1>๐Ÿ“ Saad.AI</h1>
2128
- <p>BSc Mathematics ยท Step-by-Step Solver</p>
2129
  <div class="badge-row">
2130
- <span class="badge">Groq Free</span>
2131
- <span class="badge">SymPy Verified</span>
2132
- <span class="badge">Step-by-Step</span>
2133
- <span class="badge">LaTeX Rendered</span>
 
2134
  </div>
2135
  </div>
2136
  """, unsafe_allow_html=True)
@@ -2138,13 +2224,41 @@ st.markdown("""
2138
  # Welcome message if no chat
2139
  if not st.session_state.messages:
2140
  st.markdown("""
2141
- <div style="text-align:center; padding:2rem 1rem; color:#444;">
2142
- <div style="font-size:2.5rem; margin-bottom:0.5rem;">๐Ÿงฎ</div>
2143
- <div style="font-size:0.9rem; color:#555;">
2144
- Ask any BSc Mathematics problem below<br>
2145
- <span style="font-size:0.78rem; color:#333;">
2146
- Calculus ยท Linear Algebra ยท Number Theory ยท ODEs ยท Real Analysis ยท and more
2147
- </span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2148
  </div>
2149
  </div>
2150
  """, unsafe_allow_html=True)
@@ -2194,7 +2308,16 @@ if problem and problem != st.session_state.last_submitted:
2194
  # Show AI response with streaming
2195
  with st.chat_message("assistant", avatar="๐Ÿ“"):
2196
  # Step 1: SymPy computation (instant)
2197
- with st.spinner("๐Ÿงฎ Computing..."):
 
 
 
 
 
 
 
 
 
2198
  sympy_result = run_sympy(problem)
2199
 
2200
  # Step 2: Stream AI response word by word
 
36
  # โ”€โ”€ CSS โ€” ChatGPT-style, compact font, clean dark theme โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
37
  st.markdown("""
38
  <style>
39
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
40
 
41
  /* โ”€โ”€ Base โ”€โ”€ */
42
  html, body, [class*="css"] {
 
54
  /* โ”€โ”€ Header โ”€โ”€ */
55
  .saad-header {
56
  text-align: center;
57
+ padding: 1.4rem 0 0.6rem 0;
58
  margin-bottom: 0.5rem;
59
  }
60
  .saad-header h1 {
61
+ font-size: 2rem !important;
62
+ font-weight: 700;
63
+ background: linear-gradient(135deg, #3b82f6 0%, #a78bfa 50%, #60a5fa 100%);
64
+ -webkit-background-clip: text;
65
+ -webkit-text-fill-color: transparent;
66
+ background-clip: text;
67
  margin: 0;
68
+ letter-spacing: 1px;
69
  }
70
  .saad-header p {
71
+ font-size: 0.82rem;
72
+ color: #555;
73
+ margin: 0.3rem 0 0 0;
74
+ letter-spacing: 0.3px;
75
  }
76
  .badge-row {
77
  display: flex;
78
  gap: 0.4rem;
79
  justify-content: center;
80
  flex-wrap: wrap;
81
+ margin-top: 0.7rem;
82
  }
83
  .badge {
84
+ background: linear-gradient(135deg, #1a1a2e, #16213e);
85
+ border: 1px solid #2a3a5e;
86
+ color: #60a5fa;
87
+ padding: 3px 10px;
88
  border-radius: 20px;
89
  font-size: 0.68rem;
90
  font-family: 'JetBrains Mono', monospace;
91
+ letter-spacing: 0.3px;
92
+ }
93
+
94
+ /* โ”€โ”€ Welcome screen cards โ”€โ”€ */
95
+ .subject-grid {
96
+ display: grid;
97
+ grid-template-columns: repeat(3, 1fr);
98
+ gap: 0.5rem;
99
+ margin: 1rem 0;
100
+ }
101
+ .subject-card {
102
+ background: #111827;
103
+ border: 1px solid #1f2937;
104
+ border-radius: 10px;
105
+ padding: 0.6rem 0.5rem;
106
+ text-align: center;
107
+ font-size: 0.75rem;
108
+ color: #9ca3af;
109
+ transition: all 0.2s;
110
+ }
111
+ .subject-card:hover {
112
+ border-color: #3b82f6;
113
+ color: #60a5fa;
114
+ background: #0f172a;
115
+ }
116
+ .subject-card .icon {
117
+ font-size: 1.3rem;
118
+ display: block;
119
+ margin-bottom: 0.2rem;
120
  }
121
 
122
  /* โ”€โ”€ Chat messages โ€” override Streamlit defaults โ”€โ”€ */
 
134
  }
135
  [data-testid="stChatMessage"]:has([data-testid="chatAvatarIcon-user"])
136
  [data-testid="stChatMessageContent"] {
137
+ background: linear-gradient(135deg, #1e3a5f, #1a2f4a) !important;
138
  border: 1px solid #2a4a7f !important;
139
  border-radius: 18px 4px 18px 18px !important;
140
  padding: 0.6rem 0.9rem !important;
 
146
  /* Assistant message */
147
  [data-testid="stChatMessage"]:has([data-testid="chatAvatarIcon-assistant"])
148
  [data-testid="stChatMessageContent"] {
149
+ background: #111827 !important;
150
+ border: 1px solid #1f2937 !important;
151
  border-radius: 4px 18px 18px 18px !important;
152
  padding: 0.7rem 1rem !important;
153
  font-size: 0.88rem !important;
 
157
 
158
  /* Math display blocks */
159
  .katex-display {
160
+ background: #0f172a !important;
161
  border-left: 3px solid #3b82f6 !important;
162
+ border-radius: 0 8px 8px 0 !important;
163
+ padding: 0.6rem 1rem !important;
164
+ margin: 0.5rem 0 !important;
165
  overflow-x: auto !important;
166
  }
167
  .katex { font-size: 1em !important; }
 
175
 
176
  /* โ”€โ”€ Input box โ”€โ”€ */
177
  [data-testid="stChatInput"] {
178
+ background: #111827 !important;
179
+ border: 1px solid #1f2937 !important;
180
+ border-radius: 14px !important;
181
  }
182
  [data-testid="stChatInput"] textarea {
183
  font-size: 0.88rem !important;
 
187
 
188
  /* โ”€โ”€ Sidebar โ”€โ”€ */
189
  [data-testid="stSidebar"] {
190
+ background: linear-gradient(180deg, #080810 0%, #0a0a14 100%) !important;
191
+ border-right: 1px solid #1a1a2e !important;
192
  }
193
  [data-testid="stSidebar"] * {
194
  font-size: 0.82rem !important;
195
  }
196
 
197
+ /* Sidebar topic chips */
198
+ .topic-chip {
199
+ display: inline-block;
200
+ background: #111827;
201
+ border: 1px solid #1f2937;
202
+ color: #6b7280;
203
+ padding: 3px 10px;
204
+ border-radius: 20px;
205
+ font-size: 0.72rem;
206
+ margin: 2px 2px;
207
+ transition: all 0.15s;
208
+ }
209
+ .topic-chip:hover {
210
+ border-color: #3b82f6;
211
+ color: #60a5fa;
212
+ }
213
+
214
+ /* Sidebar engine info */
215
+ .engine-row {
216
+ display: flex;
217
+ align-items: center;
218
+ gap: 0.4rem;
219
+ padding: 0.25rem 0;
220
+ color: #4b5563;
221
+ font-size: 0.75rem;
222
+ }
223
+ .engine-dot {
224
+ width: 6px;
225
+ height: 6px;
226
+ border-radius: 50%;
227
+ background: #22c55e;
228
+ flex-shrink: 0;
229
+ box-shadow: 0 0 4px #22c55e;
230
+ }
231
+
232
  /* โ”€โ”€ Buttons โ”€โ”€ */
233
  .stButton > button {
234
+ background: #111827 !important;
235
+ border: 1px solid #1f2937 !important;
236
+ color: #6b7280 !important;
237
  border-radius: 8px !important;
238
  font-size: 0.78rem !important;
239
  padding: 0.3rem 0.8rem !important;
 
244
  .stButton > button:hover {
245
  border-color: #3b82f6 !important;
246
  color: #ececec !important;
247
+ background: #0f172a !important;
248
  }
249
 
250
+ /* โ”€โ”€ Copy button โ”€โ”€ */
251
  [data-testid="stChatMessage"] .stButton > button {
252
  background: transparent !important;
253
+ border: 1px solid #1f2937 !important;
254
+ color: #4b5563 !important;
255
  border-radius: 6px !important;
256
  font-size: 0.75rem !important;
257
  padding: 2px 6px !important;
 
263
  [data-testid="stChatMessage"] .stButton > button:hover {
264
  border-color: #3b82f6 !important;
265
  color: #ececec !important;
266
+ background: #0f172a !important;
267
  }
268
 
269
+ /* โ”€โ”€ Spinner โ€” custom math themed โ”€โ”€ */
270
  .stSpinner > div { border-top-color: #3b82f6 !important; }
271
+ .stSpinner p {
272
+ color: #3b82f6 !important;
273
+ font-size: 0.82rem !important;
274
+ font-family: 'JetBrains Mono', monospace !important;
275
+ }
276
 
277
  /* โ”€โ”€ Divider โ”€โ”€ */
278
+ hr { border-color: #1a1a2e !important; }
279
 
280
  /* โ”€โ”€ Selectbox โ”€โ”€ */
281
  .stSelectbox > div > div {
282
+ background: #111827 !important;
283
+ border-color: #1f2937 !important;
284
  color: #ececec !important;
285
  border-radius: 8px !important;
286
  font-size: 0.82rem !important;
287
  }
288
+
289
+ /* โ”€โ”€ Scrollbar โ”€โ”€ */
290
+ ::-webkit-scrollbar { width: 4px; height: 4px; }
291
+ ::-webkit-scrollbar-track { background: #0f0f0f; }
292
+ ::-webkit-scrollbar-thumb { background: #1f2937; border-radius: 2px; }
293
+ ::-webkit-scrollbar-thumb:hover { background: #3b82f6; }
294
  </style>
295
  """, unsafe_allow_html=True)
296
 
 
1826
  " โ†’ Never skip this structure. Never merge steps. Never jump to answer without showing work.\n"
1827
  " โ†’ If user says plot/draw/graph/sketch/visualize: a real graph renders automatically.\n"
1828
  " Do NOT draw ASCII art. Do NOT say you cannot draw.\n"
1829
+ " Give this SHORT response only โ€” then graph renders below automatically:\n"
1830
  " ๐Ÿ“Œ **Function:** state f(x) clearly in LaTeX\n"
1831
  " ๐Ÿ” **Key Features:**\n"
1832
  " - Domain and range\n"
1833
+ " - x-intercepts: solve f(x)=0\n"
1834
  " - y-intercept: f(0)\n"
1835
  " - Turning points / vertex if any\n"
1836
  " - Behavior as $x \\to \\pm\\infty$\n"
1837
+ " ๐Ÿ“Š **Graph** is shown below.\n"
1838
+ " Keep it SHORT โ€” max 8 lines. No long paragraphs. No step-by-step for graph requests.\n\n"
1839
+
 
 
 
 
 
 
1840
  "RULE 2 โ€” LATEX (zero exceptions):\n"
1841
  " - Inline math (inside a sentence): $expression$\n"
1842
  " - Display math (standalone line, centered): $$expression$$\n"
 
2144
  st.divider()
2145
 
2146
  st.markdown("**๐ŸŽฏ Topics**")
2147
+ st.markdown("""
2148
+ <div style="padding:0.2rem 0 0.4rem 0; line-height:2;">
2149
+ <span class="topic-chip">๐Ÿ“ˆ Calculus</span>
2150
+ <span class="topic-chip">๐Ÿ”ข Linear Algebra</span>
2151
+ <span class="topic-chip">๐Ÿ” Number Theory</span>
2152
+ <span class="topic-chip">๐Ÿ“‰ ODEs</span>
2153
+ <span class="topic-chip">๐Ÿงฎ Numerical</span>
2154
+ <span class="topic-chip">๐Ÿ“ Diff. Geometry</span>
2155
+ <span class="topic-chip">๐ŸŒŠ Hydro Mechanics</span>
2156
+ <span class="topic-chip">๐Ÿ” Theory of Numbers</span>
2157
+ <span class="topic-chip">๐Ÿ“Š Real Analysis II</span>
2158
+ <span class="topic-chip">๐Ÿ“ˆ Graph Plotting</span>
2159
+ <span class="topic-chip">โž• General Math</span>
2160
+ </div>
2161
+ """, unsafe_allow_html=True)
2162
 
2163
  st.divider()
2164
  st.markdown("**โšก Example Problems**")
 
2186
 
2187
  st.divider()
2188
  st.markdown("**๐Ÿ”ง Engine**")
2189
+ st.markdown("""
2190
+ <div style="padding:0.2rem 0;">
2191
+ <div class="engine-row"><div class="engine-dot"></div>Groq Llama 3.3 70B โ€” reasoning</div>
2192
+ <div class="engine-row"><div class="engine-dot"></div>SymPy โ€” verified computation</div>
2193
+ <div class="engine-row"><div class="engine-dot"></div>6 providers โ€” 46,400 req/day</div>
2194
+ <div class="engine-row"><div class="engine-dot"></div>Zero arithmetic errors</div>
2195
+ </div>
2196
+ """, unsafe_allow_html=True)
2197
 
2198
  st.divider()
2199
  if st.button("๐Ÿ—‘๏ธ Clear Chat", use_container_width=True):
 
2210
  st.markdown("""
2211
  <div class="saad-header">
2212
  <h1>๐Ÿ“ Saad.AI</h1>
2213
+ <p>BSc Mathematics ยท Step-by-Step Solver ยท SymPy Verified</p>
2214
  <div class="badge-row">
2215
+ <span class="badge">โšก Groq Free</span>
2216
+ <span class="badge">๐Ÿงฎ SymPy Verified</span>
2217
+ <span class="badge">๐Ÿ“Š Step-by-Step</span>
2218
+ <span class="badge">โˆ‘ LaTeX Rendered</span>
2219
+ <span class="badge">๐Ÿ“ˆ Graph Plotting</span>
2220
  </div>
2221
  </div>
2222
  """, unsafe_allow_html=True)
 
2224
  # Welcome message if no chat
2225
  if not st.session_state.messages:
2226
  st.markdown("""
2227
+ <div style="text-align:center; padding:1.5rem 0 0.5rem 0;">
2228
+ <div style="font-size:0.85rem; color:#4b5563; margin-bottom:1.2rem;">
2229
+ Ask any BSc Mathematics problem โ€” I'll solve it step by step
2230
+ </div>
2231
+ <div class="subject-grid">
2232
+ <div class="subject-card">
2233
+ <span class="icon">๐Ÿ“ˆ</span>Calculus
2234
+ </div>
2235
+ <div class="subject-card">
2236
+ <span class="icon">๐Ÿ”ข</span>Linear Algebra
2237
+ </div>
2238
+ <div class="subject-card">
2239
+ <span class="icon">๐Ÿ“‰</span>ODEs
2240
+ </div>
2241
+ <div class="subject-card">
2242
+ <span class="icon">๐Ÿงฎ</span>Numerical Methods
2243
+ </div>
2244
+ <div class="subject-card">
2245
+ <span class="icon">๐Ÿ”</span>Number Theory
2246
+ </div>
2247
+ <div class="subject-card">
2248
+ <span class="icon">๐Ÿ“</span>Diff. Geometry
2249
+ </div>
2250
+ <div class="subject-card">
2251
+ <span class="icon">๐ŸŒŠ</span>Hydro Mechanics
2252
+ </div>
2253
+ <div class="subject-card">
2254
+ <span class="icon">๐Ÿ“Š</span>Real Analysis II
2255
+ </div>
2256
+ <div class="subject-card">
2257
+ <span class="icon">๐Ÿ“ˆ</span>Graph Plotting
2258
+ </div>
2259
+ </div>
2260
+ <div style="font-size:0.72rem; color:#374151; margin-top:1rem;">
2261
+ ๐Ÿ’ก Tip: Select an example from the sidebar or type your problem below
2262
  </div>
2263
  </div>
2264
  """, unsafe_allow_html=True)
 
2308
  # Show AI response with streaming
2309
  with st.chat_message("assistant", avatar="๐Ÿ“"):
2310
  # Step 1: SymPy computation (instant)
2311
+ import random
2312
+ spinner_msgs = [
2313
+ "๐Ÿงฎ Computing with SymPy...",
2314
+ "โˆซ Integrating the solution...",
2315
+ "โˆ‘ Summing it all up...",
2316
+ "๐Ÿ“ Applying the formula...",
2317
+ "๐Ÿ”ข Crunching the numbers...",
2318
+ "๐Ÿ“Š Verifying the answer...",
2319
+ ]
2320
+ with st.spinner(random.choice(spinner_msgs)):
2321
  sympy_result = run_sympy(problem)
2322
 
2323
  # Step 2: Stream AI response word by word