Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,9 +83,12 @@ SYSTEM = r"""
|
|
| 83 |
- اگر مسئله محاسباتی است، دادهها و خواسته را مشخص کن و راهحل را مرحلهبهمرحله پیش ببر.
|
| 84 |
- فرمول مناسب را معرفی کن، مقادیر را جایگذاری کن و محاسبات را تا حد امکان روشن بنویس.
|
| 85 |
- در پایان، نتیجه را به زبان ساده و در بافت مسئله تفسیر کن؛ واحدها و فرضهای مهم را فراموش نکن.
|
| 86 |
-
-
|
|
|
|
|
|
|
|
|
|
| 87 |
- فرمولهای درون متن را با $...$ و فرمولهای مستقل را با $$...$$ بنویس.
|
| 88 |
-
- از جدول فقط وقتی استفاده کن که خوانایی را بهتر میکند. پاسخ را بیدلیل طولانی نکن؛
|
| 89 |
- اگر دادهای کم است یا صورت سؤال مبهم است، فرض پنهانی نساز؛ ابهام را مشخص کن یا سؤال روشنکننده بپرس.
|
| 90 |
- نتیجه عددی را حدس نزن. محاسبات را بررسی کن و اگر اطمینان نداری، صادقانه بیان کن.
|
| 91 |
- اگر درخواست خارج از آمار و احتمال بود، تا جای ممکن کمک کن و مرز تخصص را روشن نگه دار.
|
|
@@ -223,36 +226,52 @@ def answer(message, history):
|
|
| 223 |
# -----------------------------------------------------------------------------
|
| 224 |
CUSTOM_CSS = r"""
|
| 225 |
:root {
|
| 226 |
-
color-scheme:
|
| 227 |
-
--ink: #
|
| 228 |
-
--muted: #
|
| 229 |
-
--
|
| 230 |
-
--
|
| 231 |
}
|
| 232 |
|
| 233 |
html, body {
|
| 234 |
margin: 0 !important;
|
| 235 |
-
background: #
|
|
|
|
| 236 |
}
|
| 237 |
body {
|
| 238 |
background-image:
|
| 239 |
-
radial-gradient(ellipse at
|
| 240 |
-
radial-gradient(ellipse at
|
| 241 |
-
linear-gradient(180deg, #
|
| 242 |
-
color: var(--ink) !important;
|
| 243 |
}
|
| 244 |
.gradio-container {
|
| 245 |
max-width: 1320px !important;
|
| 246 |
margin: 0 auto !important;
|
| 247 |
-
padding:
|
| 248 |
background: transparent !important;
|
| 249 |
-
color: var(--ink) !important;
|
|
|
|
| 250 |
font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
}
|
| 252 |
.gradio-container * {
|
| 253 |
font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif;
|
| 254 |
}
|
| 255 |
|
|
|
|
| 256 |
#stats-header {
|
| 257 |
direction: rtl;
|
| 258 |
position: relative;
|
|
@@ -264,9 +283,9 @@ body {
|
|
| 264 |
padding: 26px 30px;
|
| 265 |
margin: 2px 0 16px;
|
| 266 |
border-radius: 26px;
|
| 267 |
-
border: 1px solid
|
| 268 |
-
background: linear-gradient(120deg,
|
| 269 |
-
box-shadow: 0
|
| 270 |
}
|
| 271 |
#stats-header:after {
|
| 272 |
content: "";
|
|
@@ -276,46 +295,54 @@ body {
|
|
| 276 |
width: 310px;
|
| 277 |
height: 310px;
|
| 278 |
border-radius: 50%;
|
| 279 |
-
border: 1px solid rgba(
|
| 280 |
-
box-shadow: 0 0 0 28px rgba(
|
| 281 |
pointer-events: none;
|
| 282 |
}
|
| 283 |
-
.brand-lockup { display:flex; align-items:center; gap:18px; z-index:1; }
|
| 284 |
.brand-symbol {
|
| 285 |
width:66px; height:66px; flex:0 0 66px; border-radius:21px;
|
| 286 |
display:flex; align-items:center; justify-content:center;
|
| 287 |
-
font-size:32px; font-weight:800; color:#
|
| 288 |
-
background:linear-gradient(145deg, #4f46e5, #0891b2);
|
| 289 |
-
box-shadow:0
|
| 290 |
}
|
| 291 |
.brand-eyebrow {
|
| 292 |
-
direction:ltr; text-align:right; color:#
|
| 293 |
-
font-weight:
|
| 294 |
}
|
| 295 |
-
#stats-header h1 { margin:0 0 8px; color:#
|
| 296 |
-
#stats-header p { margin:0; color:#
|
| 297 |
.status-pill {
|
| 298 |
z-index:1; display:flex; align-items:center; gap:9px; white-space:nowrap;
|
| 299 |
-
padding:10px 14px; border:1px solid
|
| 300 |
-
background:
|
| 301 |
}
|
| 302 |
-
.status-dot { width:8px; height:8px; display:inline-block; border-radius:50%; background:#
|
| 303 |
|
| 304 |
#stats-features { direction:rtl; display:flex; flex-wrap:wrap; gap:9px; margin:0 2px 14px; }
|
| 305 |
.feature-chip {
|
| 306 |
-
border:1px solid
|
| 307 |
border-radius:999px; padding:7px 12px; font-size:12px; line-height:1.6;
|
|
|
|
| 308 |
}
|
|
|
|
|
|
|
| 309 |
#chat-shell {
|
| 310 |
-
padding:
|
| 311 |
border-radius:26px;
|
| 312 |
-
border:1px solid
|
| 313 |
-
background:
|
| 314 |
-
box-shadow:0
|
|
|
|
| 315 |
}
|
| 316 |
-
#stats-chatbot
|
|
|
|
|
|
|
|
|
|
| 317 |
border:0 !important;
|
| 318 |
background:transparent !important;
|
|
|
|
| 319 |
}
|
| 320 |
#stats-chatbot .message {
|
| 321 |
font-size:15px !important;
|
|
@@ -325,43 +352,154 @@ body {
|
|
| 325 |
}
|
| 326 |
#stats-chatbot .message-wrap { gap:12px !important; }
|
| 327 |
#stats-chatbot .message-bubble {
|
|
|
|
|
|
|
| 328 |
border-radius:18px !important;
|
| 329 |
padding:15px 18px !important;
|
| 330 |
-
border:1px solid
|
| 331 |
-
box-shadow:0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
}
|
| 333 |
-
#stats-chatbot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
#stats-chatbot ul, #stats-chatbot ol { padding-right:1.7em !important; padding-left:0 !important; }
|
| 335 |
#stats-chatbot pre, #stats-chatbot code {
|
| 336 |
direction:ltr !important; text-align:left !important;
|
|
|
|
| 337 |
font-family:Consolas, "Courier New", monospace !important;
|
| 338 |
}
|
| 339 |
-
#stats-chatbot pre { overflow-x:auto !important; border-radius:12px !important; }
|
| 340 |
#stats-chatbot table { display:block; max-width:100%; overflow-x:auto; border-collapse:collapse; }
|
| 341 |
-
#stats-chatbot th, #stats-chatbot td { padding:8px 12px !important; }
|
|
|
|
|
|
|
| 342 |
#stats-chatbot .katex-display { direction:ltr; max-width:100%; overflow-x:auto; overflow-y:hidden; padding:8px 2px; }
|
| 343 |
|
| 344 |
-
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
border-radius:19px !important;
|
| 347 |
-
background:
|
| 348 |
-
|
|
|
|
| 349 |
}
|
| 350 |
-
#stats-input
|
| 351 |
-
|
| 352 |
-
color:#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
padding:13px 15px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
}
|
| 355 |
-
#stats-input textarea::
|
| 356 |
-
|
| 357 |
-
#
|
| 358 |
-
background:
|
| 359 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
}
|
|
|
|
|
|
|
| 361 |
|
| 362 |
#stats-footer {
|
| 363 |
margin:14px 4px 0; direction:rtl; text-align:center;
|
| 364 |
-
color:#
|
| 365 |
}
|
| 366 |
footer { display:none !important; }
|
| 367 |
|
|
@@ -375,11 +513,13 @@ footer { display:none !important; }
|
|
| 375 |
.status-pill { display:none; }
|
| 376 |
#chat-shell { padding:5px; border-radius:19px; }
|
| 377 |
#stats-chatbot .message { font-size:14px !important; }
|
|
|
|
| 378 |
}
|
| 379 |
"""
|
| 380 |
|
| 381 |
|
| 382 |
with gr.Blocks(
|
|
|
|
| 383 |
css=CUSTOM_CSS,
|
| 384 |
title="دستیار احتمال و آمار مهندسی دانشگاه تهران | Rezaeian StatsAI",
|
| 385 |
analytics_enabled=False,
|
|
@@ -392,7 +532,7 @@ with gr.Blocks(
|
|
| 392 |
<div>
|
| 393 |
<div class="brand-eyebrow">ENGINEERING • STATISTICS • PROBABILITY</div>
|
| 394 |
<h1>دستیار احتمال و آمار مهندسی دانشگاه تهران</h1>
|
| 395 |
-
<p>
|
| 396 |
</div>
|
| 397 |
</div>
|
| 398 |
<div class="status-pill"><span class="status-dot"></span> آماده پاسخگویی</div>
|
|
@@ -429,7 +569,7 @@ with gr.Blocks(
|
|
| 429 |
"<div style='font-size:34px; margin-bottom:12px;'>∑</div>"
|
| 430 |
"<strong style='font-size:19px;'>از کجا شروع کنیم؟</strong><br>"
|
| 431 |
"سؤال خود را درباره آمار یا احتمال مهندسی بنویسید. "
|
| 432 |
-
"م
|
| 433 |
"</div>"
|
| 434 |
),
|
| 435 |
show_label=False,
|
|
|
|
| 83 |
- اگر مسئله محاسباتی است، دادهها و خواسته را مشخص کن و راهحل را مرحلهبهمرحله پیش ببر.
|
| 84 |
- فرمول مناسب را معرفی کن، مقادیر را جایگذاری کن و محاسبات را تا حد امکان روشن بنویس.
|
| 85 |
- در پایان، نتیجه را به زبان ساده و در بافت مسئله تفسیر کن؛ واحدها و فرضهای مهم را فراموش نکن.
|
| 86 |
+
- در پاسخهای آموزشی، علاوه بر توضیح، دستکم یک مثال مرتبط و روشن ارائه کن و آن را حل یا تشریح کن؛ مثال باید با موضوع همان پرسش مرتبط باشد.
|
| 87 |
+
- اگر کاربر یک مسئله عددی داده است، ابتدا همان مسئله را کامل حل کن و سپس در صورت تناسب یک مثال مشابه کوتاه با پاسخ نهایی بیاور. اگر کاربر صریحاً فقط جواب نهایی یا فقط تعریف خواست، به همان درخواست احترام بگذار.
|
| 88 |
+
- برای مسئلههای محاسباتی، در صورت تناسب از این ساختار استفاده کن: «ایده اصلی»، «فرمول»، «حل مرحلهبهمرحله»، «مثال کاربردی حلشده» و «نتیجه و تفسیر».
|
| 89 |
+
- برای پرسش مفهومی، تعریف دقیق و شهود ساده بده و سپس یک مثال عددی یا کاربردی کوتاه اضافه کن.
|
| 90 |
- فرمولهای درون متن را با $...$ و فرمولهای مستقل را با $$...$$ بنویس.
|
| 91 |
+
- از جدول فقط وقتی استفاده کن که خوانایی را بهتر میکند. پاسخ را بیدلیل طولانی نکن؛ جزئیات باید کافی و منظم باشند.
|
| 92 |
- اگر دادهای کم است یا صورت سؤال مبهم است، فرض پنهانی نساز؛ ابهام را مشخص کن یا سؤال روشنکننده بپرس.
|
| 93 |
- نتیجه عددی را حدس نزن. محاسبات را بررسی کن و اگر اطمینان نداری، صادقانه بیان کن.
|
| 94 |
- اگر درخواست خارج از آمار و احتمال بود، تا جای ممکن کمک کن و مرز تخصص را روشن نگه دار.
|
|
|
|
| 226 |
# -----------------------------------------------------------------------------
|
| 227 |
CUSTOM_CSS = r"""
|
| 228 |
:root {
|
| 229 |
+
color-scheme: light;
|
| 230 |
+
--stats-ink: #17243b;
|
| 231 |
+
--stats-muted: #53657d;
|
| 232 |
+
--stats-line: #d8e2f0;
|
| 233 |
+
--stats-blue: #315be8;
|
| 234 |
}
|
| 235 |
|
| 236 |
html, body {
|
| 237 |
margin: 0 !important;
|
| 238 |
+
background: #f3f6fc !important;
|
| 239 |
+
color: var(--stats-ink) !important;
|
| 240 |
}
|
| 241 |
body {
|
| 242 |
background-image:
|
| 243 |
+
radial-gradient(ellipse at 8% 0%, rgba(86, 126, 246, .11), transparent 34%),
|
| 244 |
+
radial-gradient(ellipse at 96% 12%, rgba(116, 87, 220, .08), transparent 28%),
|
| 245 |
+
linear-gradient(180deg, #f8faff 0%, #f0f4fb 100%) !important;
|
|
|
|
| 246 |
}
|
| 247 |
.gradio-container {
|
| 248 |
max-width: 1320px !important;
|
| 249 |
margin: 0 auto !important;
|
| 250 |
+
padding: 16px 20px 24px !important;
|
| 251 |
background: transparent !important;
|
| 252 |
+
color: var(--stats-ink) !important;
|
| 253 |
+
color-scheme: light !important;
|
| 254 |
font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif !important;
|
| 255 |
+
--body-text-color: #17243b !important;
|
| 256 |
+
--body-text-color-subdued: #53657d !important;
|
| 257 |
+
--background-fill-primary: #ffffff !important;
|
| 258 |
+
--background-fill-secondary: #f5f8fe !important;
|
| 259 |
+
--background-fill-tertiary: #edf2fa !important;
|
| 260 |
+
--border-color-primary: #d5dfed !important;
|
| 261 |
+
--border-color-accent: #b5c8ee !important;
|
| 262 |
+
--input-text-color: #17243b !important;
|
| 263 |
+
--input-background-fill: #ffffff !important;
|
| 264 |
+
--input-background-fill-focus: #ffffff !important;
|
| 265 |
+
--input-placeholder-color: #65758d !important;
|
| 266 |
+
--button-primary-background-fill: #315be8 !important;
|
| 267 |
+
--button-primary-background-fill-hover: #2449c8 !important;
|
| 268 |
+
--button-primary-text-color: #ffffff !important;
|
| 269 |
}
|
| 270 |
.gradio-container * {
|
| 271 |
font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif;
|
| 272 |
}
|
| 273 |
|
| 274 |
+
/* Bright, high-contrast header */
|
| 275 |
#stats-header {
|
| 276 |
direction: rtl;
|
| 277 |
position: relative;
|
|
|
|
| 283 |
padding: 26px 30px;
|
| 284 |
margin: 2px 0 16px;
|
| 285 |
border-radius: 26px;
|
| 286 |
+
border: 1px solid #d8e3f4;
|
| 287 |
+
background: linear-gradient(120deg, #ffffff 0%, #f0f5ff 58%, #f4f0ff 100%);
|
| 288 |
+
box-shadow: 0 14px 38px rgba(43, 67, 112, .08), inset 0 1px 0 rgba(255,255,255,.95);
|
| 289 |
}
|
| 290 |
#stats-header:after {
|
| 291 |
content: "";
|
|
|
|
| 295 |
width: 310px;
|
| 296 |
height: 310px;
|
| 297 |
border-radius: 50%;
|
| 298 |
+
border: 1px solid rgba(79, 105, 218, .13);
|
| 299 |
+
box-shadow: 0 0 0 28px rgba(79, 105, 218, .035), 0 0 0 58px rgba(8, 145, 178, .025);
|
| 300 |
pointer-events: none;
|
| 301 |
}
|
| 302 |
+
.brand-lockup { display:flex; align-items:center; gap:18px; z-index:1; min-width:0; }
|
| 303 |
.brand-symbol {
|
| 304 |
width:66px; height:66px; flex:0 0 66px; border-radius:21px;
|
| 305 |
display:flex; align-items:center; justify-content:center;
|
| 306 |
+
font-size:32px; font-weight:800; color:#ffffff !important;
|
| 307 |
+
background:linear-gradient(145deg, #4f46e5 0%, #2563eb 52%, #0891b2 100%);
|
| 308 |
+
box-shadow:0 9px 24px rgba(49,91,232,.23), inset 0 1px 0 rgba(255,255,255,.36);
|
| 309 |
}
|
| 310 |
.brand-eyebrow {
|
| 311 |
+
direction:ltr; text-align:right; color:#315be8 !important; font-size:11px;
|
| 312 |
+
font-weight:850; letter-spacing:1.6px; margin-bottom:7px;
|
| 313 |
}
|
| 314 |
+
#stats-header h1 { margin:0 0 8px; color:#152544 !important; font-size:clamp(21px, 3vw, 31px); font-weight:850; line-height:1.6; }
|
| 315 |
+
#stats-header p { margin:0; color:#52637d !important; font-size:14px; line-height:1.9; }
|
| 316 |
.status-pill {
|
| 317 |
z-index:1; display:flex; align-items:center; gap:9px; white-space:nowrap;
|
| 318 |
+
padding:10px 14px; border:1px solid #b9ead5; border-radius:999px;
|
| 319 |
+
background:#eafaf2; color:#146c48 !important; font-size:12px; font-weight:750;
|
| 320 |
}
|
| 321 |
+
.status-dot { width:8px; height:8px; display:inline-block; border-radius:50%; background:#16a36a; box-shadow:0 0 10px rgba(22,163,106,.32); }
|
| 322 |
|
| 323 |
#stats-features { direction:rtl; display:flex; flex-wrap:wrap; gap:9px; margin:0 2px 14px; }
|
| 324 |
.feature-chip {
|
| 325 |
+
border:1px solid #d9e3f2; background:rgba(255,255,255,.9); color:#344967 !important;
|
| 326 |
border-radius:999px; padding:7px 12px; font-size:12px; line-height:1.6;
|
| 327 |
+
box-shadow:0 2px 7px rgba(36,55,91,.035);
|
| 328 |
}
|
| 329 |
+
|
| 330 |
+
/* Chat panel: white surface and dark, readable text */
|
| 331 |
#chat-shell {
|
| 332 |
+
padding:12px;
|
| 333 |
border-radius:26px;
|
| 334 |
+
border:1px solid #dbe4f1;
|
| 335 |
+
background:rgba(255,255,255,.96);
|
| 336 |
+
box-shadow:0 18px 46px rgba(44, 65, 103, .09), inset 0 1px 0 #ffffff;
|
| 337 |
+
color:#17243b !important;
|
| 338 |
}
|
| 339 |
+
#stats-chatbot,
|
| 340 |
+
#stats-chatbot > div,
|
| 341 |
+
#stats-chatbot .wrap,
|
| 342 |
+
#stats-chatbot .scroll-hide {
|
| 343 |
border:0 !important;
|
| 344 |
background:transparent !important;
|
| 345 |
+
color:#17243b !important;
|
| 346 |
}
|
| 347 |
#stats-chatbot .message {
|
| 348 |
font-size:15px !important;
|
|
|
|
| 352 |
}
|
| 353 |
#stats-chatbot .message-wrap { gap:12px !important; }
|
| 354 |
#stats-chatbot .message-bubble {
|
| 355 |
+
color:#17243b !important;
|
| 356 |
+
background:#ffffff !important;
|
| 357 |
border-radius:18px !important;
|
| 358 |
padding:15px 18px !important;
|
| 359 |
+
border:1px solid #dce5f2 !important;
|
| 360 |
+
box-shadow:0 5px 16px rgba(41, 59, 91, .055) !important;
|
| 361 |
+
}
|
| 362 |
+
#stats-chatbot .message.user,
|
| 363 |
+
#stats-chatbot .message.user .message-bubble {
|
| 364 |
+
background:#eaf0ff !important;
|
| 365 |
+
color:#17294b !important;
|
| 366 |
+
border-color:#cfdbfa !important;
|
| 367 |
+
}
|
| 368 |
+
#stats-chatbot .message.bot,
|
| 369 |
+
#stats-chatbot .message.bot .message-bubble {
|
| 370 |
+
background:#ffffff !important;
|
| 371 |
+
color:#17243b !important;
|
| 372 |
+
border-color:#dce5f2 !important;
|
| 373 |
+
}
|
| 374 |
+
#stats-chatbot .message-bubble p,
|
| 375 |
+
#stats-chatbot .message-bubble li,
|
| 376 |
+
#stats-chatbot .message-bubble h1,
|
| 377 |
+
#stats-chatbot .message-bubble h2,
|
| 378 |
+
#stats-chatbot .message-bubble h3,
|
| 379 |
+
#stats-chatbot .message-bubble h4,
|
| 380 |
+
#stats-chatbot .message-bubble strong,
|
| 381 |
+
#stats-chatbot .message-bubble em,
|
| 382 |
+
#stats-chatbot .message-bubble blockquote,
|
| 383 |
+
#stats-chatbot .message-bubble td,
|
| 384 |
+
#stats-chatbot .message-bubble th,
|
| 385 |
+
#stats-chatbot .message-bubble span {
|
| 386 |
+
color:inherit !important;
|
| 387 |
}
|
| 388 |
+
#stats-chatbot .message-bubble h1,
|
| 389 |
+
#stats-chatbot .message-bubble h2,
|
| 390 |
+
#stats-chatbot .message-bubble h3,
|
| 391 |
+
#stats-chatbot .message-bubble h4 { font-weight:800 !important; line-height:1.8 !important; }
|
| 392 |
+
#stats-chatbot .message-bubble a { color:#1558c8 !important; text-decoration:underline; }
|
| 393 |
+
#stats-chatbot p { line-height:2.0 !important; margin:.48em 0 !important; }
|
| 394 |
#stats-chatbot ul, #stats-chatbot ol { padding-right:1.7em !important; padding-left:0 !important; }
|
| 395 |
#stats-chatbot pre, #stats-chatbot code {
|
| 396 |
direction:ltr !important; text-align:left !important;
|
| 397 |
+
color:#17243b !important; background:#f0f4fa !important;
|
| 398 |
font-family:Consolas, "Courier New", monospace !important;
|
| 399 |
}
|
| 400 |
+
#stats-chatbot pre { overflow-x:auto !important; border:1px solid #dce5f2 !important; border-radius:12px !important; padding:12px !important; }
|
| 401 |
#stats-chatbot table { display:block; max-width:100%; overflow-x:auto; border-collapse:collapse; }
|
| 402 |
+
#stats-chatbot th, #stats-chatbot td { padding:8px 12px !important; border:1px solid #dce5f2 !important; }
|
| 403 |
+
#stats-chatbot th { background:#f0f5fd !important; color:#17243b !important; }
|
| 404 |
+
#stats-chatbot .katex, #stats-chatbot .katex * { color:#17243b !important; }
|
| 405 |
#stats-chatbot .katex-display { direction:ltr; max-width:100%; overflow-x:auto; overflow-y:hidden; padding:8px 2px; }
|
| 406 |
|
| 407 |
+
/* Composer: specifically force dark ink on a white input surface */
|
| 408 |
+
#stats-input,
|
| 409 |
+
#stats-input > div,
|
| 410 |
+
#stats-input .wrap,
|
| 411 |
+
#stats-input .container,
|
| 412 |
+
#stats-input label {
|
| 413 |
+
border:1px solid #cfdbec !important;
|
| 414 |
border-radius:19px !important;
|
| 415 |
+
background:#ffffff !important;
|
| 416 |
+
color:#17243b !important;
|
| 417 |
+
box-shadow:0 7px 22px rgba(37, 57, 94, .07) !important;
|
| 418 |
}
|
| 419 |
+
#stats-input:focus-within,
|
| 420 |
+
#stats-input:focus-within > div {
|
| 421 |
+
border-color:#4d74ef !important;
|
| 422 |
+
box-shadow:0 0 0 3px rgba(77,116,239,.14), 0 7px 22px rgba(37,57,94,.07) !important;
|
| 423 |
+
}
|
| 424 |
+
.gradio-container #stats-input textarea,
|
| 425 |
+
.gradio-container #stats-input textarea:focus,
|
| 426 |
+
.gradio-container #stats-input textarea:active,
|
| 427 |
+
.gradio-container #stats-input input,
|
| 428 |
+
.gradio-container #stats-input input:focus {
|
| 429 |
+
direction:rtl !important;
|
| 430 |
+
text-align:right !important;
|
| 431 |
+
background:#ffffff !important;
|
| 432 |
+
background-color:#ffffff !important;
|
| 433 |
+
color:#14233d !important;
|
| 434 |
+
-webkit-text-fill-color:#14233d !important;
|
| 435 |
+
caret-color:#315be8 !important;
|
| 436 |
+
font-size:15px !important;
|
| 437 |
+
line-height:1.95 !important;
|
| 438 |
padding:13px 15px !important;
|
| 439 |
+
opacity:1 !important;
|
| 440 |
+
border:0 !important;
|
| 441 |
+
outline:none !important;
|
| 442 |
+
box-shadow:none !important;
|
| 443 |
+
}
|
| 444 |
+
.gradio-container #stats-input textarea::placeholder,
|
| 445 |
+
.gradio-container #stats-input input::placeholder {
|
| 446 |
+
color:#667792 !important;
|
| 447 |
+
-webkit-text-fill-color:#667792 !important;
|
| 448 |
+
opacity:1 !important;
|
| 449 |
}
|
| 450 |
+
.gradio-container #stats-input textarea::selection,
|
| 451 |
+
.gradio-container #stats-input input::selection {
|
| 452 |
+
color:#14233d !important;
|
| 453 |
+
background:#cbdcff !important;
|
| 454 |
+
-webkit-text-fill-color:#14233d !important;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
/* Buttons: dark text on pale surfaces; white text only on the blue send button */
|
| 458 |
+
#chat-shell button {
|
| 459 |
+
color:#273954 !important;
|
| 460 |
+
background:#f8faff !important;
|
| 461 |
+
border:1px solid #d5dfed !important;
|
| 462 |
+
border-radius:13px !important;
|
| 463 |
+
}
|
| 464 |
+
#chat-shell button span,
|
| 465 |
+
#chat-shell button svg { color:inherit !important; }
|
| 466 |
+
#chat-shell button:hover {
|
| 467 |
+
color:#1e45b8 !important;
|
| 468 |
+
background:#eef3ff !important;
|
| 469 |
+
border-color:#b8cafa !important;
|
| 470 |
+
}
|
| 471 |
+
#chat-shell .examples-holder button,
|
| 472 |
+
#chat-shell button.example,
|
| 473 |
+
#chat-shell .example-button,
|
| 474 |
+
#chat-shell [data-testid*="example"] button {
|
| 475 |
+
color:#263b5c !important;
|
| 476 |
+
background:#ffffff !important;
|
| 477 |
+
border:1px solid #d4e0f2 !important;
|
| 478 |
+
box-shadow:0 3px 10px rgba(39, 61, 100, .04) !important;
|
| 479 |
+
}
|
| 480 |
+
#chat-shell .examples-holder button:hover,
|
| 481 |
+
#chat-shell button.example:hover,
|
| 482 |
+
#chat-shell .example-button:hover,
|
| 483 |
+
#chat-shell [data-testid*="example"] button:hover {
|
| 484 |
+
color:#214bc2 !important;
|
| 485 |
+
background:#edf3ff !important;
|
| 486 |
+
border-color:#a9c1f7 !important;
|
| 487 |
+
}
|
| 488 |
+
#stats-input button,
|
| 489 |
+
#stats-input button:hover,
|
| 490 |
+
#stats-input button span,
|
| 491 |
+
#stats-input button svg {
|
| 492 |
+
color:#ffffff !important;
|
| 493 |
+
-webkit-text-fill-color:#ffffff !important;
|
| 494 |
+
background:linear-gradient(135deg,#4f46e5,#2563eb 58%,#0891b2) !important;
|
| 495 |
+
border:0 !important;
|
| 496 |
}
|
| 497 |
+
#stats-input button { border-radius:13px !important; }
|
| 498 |
+
#chat-shell button:focus-visible { outline:3px solid rgba(49,91,232,.32) !important; outline-offset:2px !important; }
|
| 499 |
|
| 500 |
#stats-footer {
|
| 501 |
margin:14px 4px 0; direction:rtl; text-align:center;
|
| 502 |
+
color:#596b84 !important; font-size:11px; line-height:1.9;
|
| 503 |
}
|
| 504 |
footer { display:none !important; }
|
| 505 |
|
|
|
|
| 513 |
.status-pill { display:none; }
|
| 514 |
#chat-shell { padding:5px; border-radius:19px; }
|
| 515 |
#stats-chatbot .message { font-size:14px !important; }
|
| 516 |
+
#stats-chatbot .message-bubble { padding:12px 13px !important; }
|
| 517 |
}
|
| 518 |
"""
|
| 519 |
|
| 520 |
|
| 521 |
with gr.Blocks(
|
| 522 |
+
theme=gr.themes.Soft(primary_hue="blue", secondary_hue="indigo", neutral_hue="slate"),
|
| 523 |
css=CUSTOM_CSS,
|
| 524 |
title="دستیار احتمال و آمار مهندسی دانشگاه تهران | Rezaeian StatsAI",
|
| 525 |
analytics_enabled=False,
|
|
|
|
| 532 |
<div>
|
| 533 |
<div class="brand-eyebrow">ENGINEERING • STATISTICS • PROBABILITY</div>
|
| 534 |
<h1>دستیار احتمال و آمار مهندسی دانشگاه تهران</h1>
|
| 535 |
+
<p>توضیح مفاهیم، حل مرحلهبهمرحله و مثالهای کاربردی برای دانشجویان مهندسی</p>
|
| 536 |
</div>
|
| 537 |
</div>
|
| 538 |
<div class="status-pill"><span class="status-dot"></span> آماده پاسخگویی</div>
|
|
|
|
| 569 |
"<div style='font-size:34px; margin-bottom:12px;'>∑</div>"
|
| 570 |
"<strong style='font-size:19px;'>از کجا شروع کنیم؟</strong><br>"
|
| 571 |
"سؤال خود را درباره آمار یا احتمال مهندسی بنویسید. "
|
| 572 |
+
"پاسخ آموزشی همراه با توضیح و مثال ارائه میشود."
|
| 573 |
"</div>"
|
| 574 |
),
|
| 575 |
show_label=False,
|