Spaces:
Sleeping
Sleeping
Arush kumar commited on
Commit Β·
867e2e4
1
Parent(s): d31b99b
Update app.py
Browse files
app.py
CHANGED
|
@@ -282,122 +282,236 @@ def _with_telemetry(text: str, n_tok: int, ttft: float, t_start: float) -> str:
|
|
| 282 |
|
| 283 |
ARYA_CSS = """
|
| 284 |
:root {
|
| 285 |
-
--arya-bg: #
|
| 286 |
-
--arya-
|
| 287 |
-
--arya-panel
|
|
|
|
| 288 |
--arya-accent: #E8A33D;
|
|
|
|
| 289 |
--arya-accent-2: #5FBFA8;
|
| 290 |
-
--arya-
|
| 291 |
-
--arya-text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
}
|
| 293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
.gradio-container {
|
| 295 |
-
background:
|
|
|
|
|
|
|
|
|
|
| 296 |
font-family: 'Inter', system-ui, sans-serif !important;
|
|
|
|
| 297 |
}
|
| 298 |
|
|
|
|
| 299 |
#arya-topbar {
|
| 300 |
display: flex;
|
| 301 |
align-items: center;
|
| 302 |
-
gap:
|
| 303 |
-
padding:
|
| 304 |
-
border-bottom: 1px solid var(--arya-
|
| 305 |
-
margin-bottom:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
}
|
|
|
|
|
|
|
| 307 |
#arya-title {
|
| 308 |
font-family: 'IBM Plex Mono', monospace;
|
| 309 |
font-weight: 700;
|
| 310 |
-
font-size: 1.
|
| 311 |
-
letter-spacing: 0.
|
| 312 |
color: var(--arya-text);
|
| 313 |
}
|
| 314 |
-
#arya-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
font-family: 'IBM Plex Mono', monospace;
|
| 316 |
-
font-size: 0.
|
|
|
|
| 317 |
color: var(--arya-accent-2);
|
| 318 |
-
display: flex;
|
| 319 |
-
|
| 320 |
-
|
|
|
|
|
|
|
|
|
|
| 321 |
}
|
| 322 |
-
#arya-status::before {
|
| 323 |
content: "";
|
| 324 |
-
width:
|
| 325 |
-
height: 7px;
|
| 326 |
-
border-radius: 50%;
|
| 327 |
background: var(--arya-accent-2);
|
| 328 |
-
box-shadow: 0 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
}
|
| 330 |
#arya-specs {
|
| 331 |
-
font-family: 'IBM Plex Mono', monospace;
|
| 332 |
-
font-size: 0.72rem;
|
| 333 |
-
color: var(--arya-text-dim);
|
| 334 |
margin-left: auto;
|
| 335 |
-
|
| 336 |
}
|
| 337 |
-
|
| 338 |
-
#arya-caption {
|
| 339 |
font-family: 'IBM Plex Mono', monospace;
|
| 340 |
-
font-size: 0.
|
|
|
|
| 341 |
color: var(--arya-text-dim);
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
|
|
|
|
|
|
| 345 |
}
|
| 346 |
|
| 347 |
-
|
| 348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 349 |
}
|
| 350 |
-
.
|
| 351 |
-
|
| 352 |
-
color: #1A1206 !important;
|
| 353 |
-
border-radius: 14px 14px 3px 14px !important;
|
| 354 |
-
}
|
| 355 |
-
.message.bot {
|
| 356 |
background: var(--arya-panel) !important;
|
| 357 |
-
|
| 358 |
-
border-radius: 14px 14px 14px 3px !important;
|
| 359 |
-
border: 1px solid var(--arya-panel-2) !important;
|
| 360 |
}
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
}
|
| 367 |
|
|
|
|
| 368 |
textarea, input[type="text"] {
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
}
|
| 374 |
-
|
| 375 |
button.primary {
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
}
|
| 380 |
"""
|
| 381 |
|
| 382 |
ARYA_HEAD = """
|
| 383 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 384 |
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;700&display=swap" rel="stylesheet">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
"""
|
| 386 |
|
| 387 |
|
| 388 |
def main():
|
| 389 |
-
|
| 390 |
-
f"{model.count_params() / 1e6:.1f}M PARAMS
|
| 391 |
-
f"
|
| 392 |
-
|
|
|
|
|
|
|
|
|
|
| 393 |
|
| 394 |
with gr.Blocks(title="Arya") as demo:
|
| 395 |
|
| 396 |
gr.HTML(f"""
|
| 397 |
<div id="arya-topbar">
|
| 398 |
-
<
|
| 399 |
-
<
|
| 400 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
</div>
|
| 402 |
""")
|
| 403 |
|
|
|
|
| 282 |
|
| 283 |
ARYA_CSS = """
|
| 284 |
:root {
|
| 285 |
+
--arya-bg: #100C1A;
|
| 286 |
+
--arya-bg-2: #17111F;
|
| 287 |
+
--arya-panel: #1D1730;
|
| 288 |
+
--arya-panel-2: #271F42;
|
| 289 |
--arya-accent: #E8A33D;
|
| 290 |
+
--arya-accent-soft: #F0BE73;
|
| 291 |
--arya-accent-2: #5FBFA8;
|
| 292 |
+
--arya-indigo: #5B67D9;
|
| 293 |
+
--arya-text: #F3EEE3;
|
| 294 |
+
--arya-text-dim: #948BAA;
|
| 295 |
+
--arya-hairline: #2A2440;
|
| 296 |
+
|
| 297 |
+
/* Retheme Gradio's OWN documented CSS variables (verified against the
|
| 298 |
+
installed theme's actual variable names) instead of guessing at
|
| 299 |
+
hashed/scoped internal component classes -- this cascades correctly
|
| 300 |
+
into sliders, checkboxes, accordions, buttons, etc. automatically,
|
| 301 |
+
and won't silently stop working on a Gradio version bump the way
|
| 302 |
+
hand-guessed internal class names would. */
|
| 303 |
+
--body-background-fill: var(--arya-bg);
|
| 304 |
+
--background-fill-primary: var(--arya-bg);
|
| 305 |
+
--background-fill-secondary: var(--arya-panel);
|
| 306 |
+
--block-background-fill: var(--arya-panel);
|
| 307 |
+
--block-border-color: var(--arya-hairline);
|
| 308 |
+
--block-title-text-color: var(--arya-text-dim);
|
| 309 |
+
--block-label-text-color: var(--arya-text-dim);
|
| 310 |
+
--body-text-color: var(--arya-text);
|
| 311 |
+
--body-text-color-subdued: var(--arya-text-dim);
|
| 312 |
+
--border-color-primary: var(--arya-hairline);
|
| 313 |
+
--border-color-accent: var(--arya-accent);
|
| 314 |
+
--color-accent: var(--arya-accent);
|
| 315 |
+
--color-accent-soft: color-mix(in srgb, var(--arya-accent) 20%, transparent);
|
| 316 |
+
--input-background-fill: var(--arya-panel-2);
|
| 317 |
+
--input-border-color: var(--arya-hairline);
|
| 318 |
+
--input-border-color-focus: var(--arya-accent);
|
| 319 |
+
--input-placeholder-color: var(--arya-text-dim);
|
| 320 |
+
--slider-color: var(--arya-accent);
|
| 321 |
+
--checkbox-background-color-selected: var(--arya-accent);
|
| 322 |
+
--checkbox-border-color-selected: var(--arya-accent);
|
| 323 |
+
--checkbox-label-background-fill-selected: color-mix(in srgb, var(--arya-accent) 18%, var(--arya-panel));
|
| 324 |
+
--button-primary-background-fill: linear-gradient(135deg, var(--arya-accent), var(--arya-accent-soft));
|
| 325 |
+
--button-primary-background-fill-hover: var(--arya-accent-soft);
|
| 326 |
+
--button-primary-text-color: #201306;
|
| 327 |
+
--button-secondary-background-fill: var(--arya-panel-2);
|
| 328 |
+
--button-secondary-border-color: var(--arya-hairline);
|
| 329 |
+
--button-secondary-background-fill-hover: var(--arya-panel);
|
| 330 |
+
--link-text-color: var(--arya-accent-2);
|
| 331 |
}
|
| 332 |
|
| 333 |
+
* { scrollbar-width: thin; scrollbar-color: var(--arya-panel-2) transparent; }
|
| 334 |
+
::-webkit-scrollbar { width: 8px; height: 8px; }
|
| 335 |
+
::-webkit-scrollbar-thumb { background: var(--arya-panel-2); border-radius: 8px; }
|
| 336 |
+
::-webkit-scrollbar-thumb:hover { background: var(--arya-hairline); }
|
| 337 |
+
|
| 338 |
.gradio-container {
|
| 339 |
+
background:
|
| 340 |
+
radial-gradient(ellipse 900px 400px at 15% -10%, color-mix(in srgb, var(--arya-accent) 10%, transparent), transparent 60%),
|
| 341 |
+
radial-gradient(ellipse 700px 400px at 100% 0%, color-mix(in srgb, var(--arya-indigo) 12%, transparent), transparent 55%),
|
| 342 |
+
var(--arya-bg) !important;
|
| 343 |
font-family: 'Inter', system-ui, sans-serif !important;
|
| 344 |
+
max-width: 880px !important;
|
| 345 |
}
|
| 346 |
|
| 347 |
+
/* ββ Topbar ββ */
|
| 348 |
#arya-topbar {
|
| 349 |
display: flex;
|
| 350 |
align-items: center;
|
| 351 |
+
gap: 12px;
|
| 352 |
+
padding: 18px 4px 16px 4px;
|
| 353 |
+
border-bottom: 1px solid var(--arya-hairline);
|
| 354 |
+
margin-bottom: 10px;
|
| 355 |
+
}
|
| 356 |
+
#arya-mark {
|
| 357 |
+
width: 34px; height: 34px; flex-shrink: 0;
|
| 358 |
+
display: flex; align-items: center; justify-content: center;
|
| 359 |
+
border-radius: 10px;
|
| 360 |
+
background: linear-gradient(135deg, var(--arya-accent), var(--arya-indigo));
|
| 361 |
+
box-shadow: 0 2px 14px color-mix(in srgb, var(--arya-accent) 35%, transparent);
|
| 362 |
}
|
| 363 |
+
#arya-mark svg { width: 19px; height: 19px; }
|
| 364 |
+
#arya-title-block { display: flex; flex-direction: column; line-height: 1.15; }
|
| 365 |
#arya-title {
|
| 366 |
font-family: 'IBM Plex Mono', monospace;
|
| 367 |
font-weight: 700;
|
| 368 |
+
font-size: 1.18rem;
|
| 369 |
+
letter-spacing: 0.14em;
|
| 370 |
color: var(--arya-text);
|
| 371 |
}
|
| 372 |
+
#arya-subtitle {
|
| 373 |
+
font-family: 'IBM Plex Mono', monospace;
|
| 374 |
+
font-size: 0.66rem;
|
| 375 |
+
letter-spacing: 0.06em;
|
| 376 |
+
color: var(--arya-text-dim);
|
| 377 |
+
}
|
| 378 |
+
#arya-status-chip {
|
| 379 |
font-family: 'IBM Plex Mono', monospace;
|
| 380 |
+
font-size: 0.72rem;
|
| 381 |
+
font-weight: 500;
|
| 382 |
color: var(--arya-accent-2);
|
| 383 |
+
display: flex; align-items: center; gap: 6px;
|
| 384 |
+
padding: 5px 10px;
|
| 385 |
+
border-radius: 999px;
|
| 386 |
+
background: color-mix(in srgb, var(--arya-accent-2) 12%, transparent);
|
| 387 |
+
border: 1px solid color-mix(in srgb, var(--arya-accent-2) 30%, transparent);
|
| 388 |
+
margin-left: 14px;
|
| 389 |
}
|
| 390 |
+
#arya-status-chip::before {
|
| 391 |
content: "";
|
| 392 |
+
width: 6px; height: 6px; border-radius: 50%;
|
|
|
|
|
|
|
| 393 |
background: var(--arya-accent-2);
|
| 394 |
+
box-shadow: 0 0 8px var(--arya-accent-2);
|
| 395 |
+
animation: arya-pulse 2s ease-in-out infinite;
|
| 396 |
+
}
|
| 397 |
+
@keyframes arya-pulse {
|
| 398 |
+
0%, 100% { opacity: 1; transform: scale(1); }
|
| 399 |
+
50% { opacity: 0.5; transform: scale(0.8); }
|
| 400 |
}
|
| 401 |
#arya-specs {
|
|
|
|
|
|
|
|
|
|
| 402 |
margin-left: auto;
|
| 403 |
+
display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
|
| 404 |
}
|
| 405 |
+
.arya-chip {
|
|
|
|
| 406 |
font-family: 'IBM Plex Mono', monospace;
|
| 407 |
+
font-size: 0.66rem;
|
| 408 |
+
letter-spacing: 0.03em;
|
| 409 |
color: var(--arya-text-dim);
|
| 410 |
+
padding: 4px 9px;
|
| 411 |
+
border-radius: 6px;
|
| 412 |
+
background: var(--arya-panel);
|
| 413 |
+
border: 1px solid var(--arya-hairline);
|
| 414 |
+
white-space: nowrap;
|
| 415 |
}
|
| 416 |
|
| 417 |
+
/* ββ Chat transcript (verified real Gradio 6 Chatbot classes, not guessed:
|
| 418 |
+
.user-row / .bot-row / .message-bubble-border confirmed present in the
|
| 419 |
+
installed package's compiled component CSS) ββ */
|
| 420 |
+
.user-row {
|
| 421 |
+
background: linear-gradient(135deg, var(--arya-accent), var(--arya-accent-soft)) !important;
|
| 422 |
+
color: #201306 !important;
|
| 423 |
}
|
| 424 |
+
.user-row * { color: #201306 !important; }
|
| 425 |
+
.bot-row {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
background: var(--arya-panel) !important;
|
| 427 |
+
border: 1px solid var(--arya-hairline) !important;
|
|
|
|
|
|
|
| 428 |
}
|
| 429 |
+
.message-bubble-border {
|
| 430 |
+
border-color: var(--arya-hairline) !important;
|
| 431 |
+
box-shadow: 0 4px 18px rgba(0,0,0,0.25);
|
| 432 |
+
animation: arya-rise 0.25s ease-out;
|
| 433 |
+
}
|
| 434 |
+
@keyframes arya-rise {
|
| 435 |
+
from { opacity: 0; transform: translateY(6px); }
|
| 436 |
+
to { opacity: 1; transform: translateY(0); }
|
| 437 |
+
}
|
| 438 |
+
.bot-row code, .bot-row pre {
|
| 439 |
+
font-family: 'IBM Plex Mono', monospace !important;
|
| 440 |
+
background: var(--arya-bg-2) !important;
|
| 441 |
+
border: 1px solid var(--arya-hairline) !important;
|
| 442 |
+
border-radius: 6px !important;
|
| 443 |
}
|
| 444 |
|
| 445 |
+
/* ββ Input row ββ */
|
| 446 |
textarea, input[type="text"] {
|
| 447 |
+
transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
|
| 448 |
+
}
|
| 449 |
+
textarea:focus, input[type="text"]:focus {
|
| 450 |
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--arya-accent) 22%, transparent) !important;
|
| 451 |
}
|
|
|
|
| 452 |
button.primary {
|
| 453 |
+
transition: transform 0.12s ease, box-shadow 0.12s ease !important;
|
| 454 |
+
box-shadow: 0 2px 12px color-mix(in srgb, var(--arya-accent) 30%, transparent) !important;
|
| 455 |
+
}
|
| 456 |
+
button.primary:hover { transform: translateY(-1px) scale(1.03); }
|
| 457 |
+
|
| 458 |
+
/* ββ Settings accordion & example chips: themed via the CSS variables
|
| 459 |
+
above, no internal class names needed ββ */
|
| 460 |
+
.example {
|
| 461 |
+
transition: transform 0.12s ease, border-color 0.12s ease !important;
|
| 462 |
+
}
|
| 463 |
+
.example:hover {
|
| 464 |
+
transform: translateY(-2px);
|
| 465 |
+
border-color: var(--arya-accent) !important;
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
#arya-caption {
|
| 469 |
+
font-family: 'IBM Plex Mono', monospace;
|
| 470 |
+
font-size: 0.68rem;
|
| 471 |
+
color: var(--arya-text-dim);
|
| 472 |
+
text-align: center;
|
| 473 |
+
padding: 16px 20px 6px 20px;
|
| 474 |
+
letter-spacing: 0.03em;
|
| 475 |
+
border-top: 1px solid var(--arya-hairline);
|
| 476 |
+
margin-top: 12px;
|
| 477 |
}
|
| 478 |
"""
|
| 479 |
|
| 480 |
ARYA_HEAD = """
|
| 481 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 482 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;700&display=swap" rel="stylesheet">
|
| 483 |
+
"""
|
| 484 |
+
|
| 485 |
+
# Simple geometric monogram, not a decorative flourish -- the gradient fill
|
| 486 |
+
# (accent -> indigo) matches #arya-mark's CSS background, single mark
|
| 487 |
+
# rather than a busier logo, keeps it legible at 19px.
|
| 488 |
+
ARYA_MARK_SVG = """
|
| 489 |
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
| 490 |
+
<path d="M12 3L21 20H16.5L12 11L7.5 20H3L12 3Z" fill="#100C1A"/>
|
| 491 |
+
</svg>
|
| 492 |
"""
|
| 493 |
|
| 494 |
|
| 495 |
def main():
|
| 496 |
+
spec_chips = [
|
| 497 |
+
f"{model.count_params() / 1e6:.1f}M PARAMS",
|
| 498 |
+
f"{numberoflayers}L",
|
| 499 |
+
f"CTX {CONTEXT}",
|
| 500 |
+
f"GQA {numberofheads}/{num_kv_heads}",
|
| 501 |
+
]
|
| 502 |
+
spec_html = "".join(f'<span class="arya-chip">{c}</span>' for c in spec_chips)
|
| 503 |
|
| 504 |
with gr.Blocks(title="Arya") as demo:
|
| 505 |
|
| 506 |
gr.HTML(f"""
|
| 507 |
<div id="arya-topbar">
|
| 508 |
+
<div id="arya-mark">{ARYA_MARK_SVG}</div>
|
| 509 |
+
<div id="arya-title-block">
|
| 510 |
+
<span id="arya-title">ARYA</span>
|
| 511 |
+
<span id="arya-subtitle">FROM-SCRATCH SMALL LM</span>
|
| 512 |
+
</div>
|
| 513 |
+
<span id="arya-status-chip">READY</span>
|
| 514 |
+
<div id="arya-specs">{spec_html}</div>
|
| 515 |
</div>
|
| 516 |
""")
|
| 517 |
|