Molbap HF Staff commited on
Commit
3ff0c13
·
1 Parent(s): 3dd1359

font and format

Browse files
Files changed (1) hide show
  1. app.py +172 -7
app.py CHANGED
@@ -315,13 +315,178 @@ INSERTS = {
315
  # ---------------------------
316
 
317
  CSS = """
318
- :root { --toc-w: 280px; }
319
- #layout { display: grid; grid-template-columns: var(--toc-w) 1fr; gap: 1.25rem; }
320
- #toc { position: sticky; top: 0.75rem; height: calc(100vh - 1.5rem); overflow: auto; padding-right: .5rem; }
321
- #toc a { text-decoration: none; display: block; padding: .25rem 0; }
322
- .section { scroll-margin-top: 72px; }
323
- .gradio-container { max-width: 1200px !important; margin: 0 auto; }
324
- hr { border: none; border-top: 1px solid var(--neutral-300); margin: 1.25rem 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  """
326
 
327
  with gr.Blocks(css=CSS, fill_height=True, title="Interactive Blog — Transformers Feature Showcase") as demo:
 
315
  # ---------------------------
316
 
317
  CSS = """
318
+ /* Import Inter font like HF blog */
319
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
320
+
321
+ :root {
322
+ --toc-w: 280px;
323
+ --text-color: #374151;
324
+ --heading-color: #111827;
325
+ --link-color: #2563eb;
326
+ --border-color: #e5e7eb;
327
+ }
328
+
329
+ /* Main layout */
330
+ #layout { display: grid; grid-template-columns: var(--toc-w) 1fr; gap: 2rem; }
331
+ #toc {
332
+ position: sticky;
333
+ top: 1rem;
334
+ height: calc(100vh - 2rem);
335
+ overflow: auto;
336
+ padding-right: 1rem;
337
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
338
+ }
339
+ #toc a {
340
+ text-decoration: none;
341
+ display: block;
342
+ padding: 0.5rem 0;
343
+ color: var(--text-color);
344
+ font-size: 0.875rem;
345
+ line-height: 1.25rem;
346
+ }
347
+ #toc a:hover { color: var(--link-color); }
348
+
349
+ /* Container styling */
350
+ .gradio-container {
351
+ max-width: 1200px !important;
352
+ margin: 0 auto !important;
353
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
354
+ }
355
+
356
+ /* Typography - matching HF blog style */
357
+ .gradio-container h1 {
358
+ font-size: 2.25rem !important;
359
+ line-height: 2.5rem !important;
360
+ font-weight: 700 !important;
361
+ color: var(--heading-color) !important;
362
+ margin: 2rem 0 1.5rem 0 !important;
363
+ font-family: 'Inter', sans-serif !important;
364
+ }
365
+
366
+ .gradio-container h2 {
367
+ font-size: 1.875rem !important;
368
+ line-height: 2.25rem !important;
369
+ font-weight: 600 !important;
370
+ color: var(--heading-color) !important;
371
+ margin: 2.5rem 0 1rem 0 !important;
372
+ font-family: 'Inter', sans-serif !important;
373
+ }
374
+
375
+ .gradio-container h3 {
376
+ font-size: 1.5rem !important;
377
+ line-height: 2rem !important;
378
+ font-weight: 600 !important;
379
+ color: var(--heading-color) !important;
380
+ margin: 2rem 0 0.75rem 0 !important;
381
+ font-family: 'Inter', sans-serif !important;
382
+ }
383
+
384
+ .gradio-container h4 {
385
+ font-size: 1.25rem !important;
386
+ line-height: 1.75rem !important;
387
+ font-weight: 600 !important;
388
+ color: var(--heading-color) !important;
389
+ margin: 1.5rem 0 0.5rem 0 !important;
390
+ font-family: 'Inter', sans-serif !important;
391
+ }
392
+
393
+ /* Body text */
394
+ .gradio-container p {
395
+ font-size: 1rem !important;
396
+ line-height: 1.75rem !important;
397
+ font-weight: 400 !important;
398
+ color: var(--text-color) !important;
399
+ margin: 1.25rem 0 !important;
400
+ font-family: 'Inter', sans-serif !important;
401
+ }
402
+
403
+ /* Lists */
404
+ .gradio-container ul, .gradio-container ol {
405
+ font-size: 1rem !important;
406
+ line-height: 1.75rem !important;
407
+ color: var(--text-color) !important;
408
+ margin: 1.25rem 0 !important;
409
+ padding-left: 1.5rem !important;
410
+ }
411
+
412
+ .gradio-container li {
413
+ margin: 0.5rem 0 !important;
414
+ }
415
+
416
+ /* Links */
417
+ .gradio-container a {
418
+ color: var(--link-color) !important;
419
+ text-decoration: underline !important;
420
+ }
421
+
422
+ .gradio-container a:hover {
423
+ text-decoration: none !important;
424
+ }
425
+
426
+ /* Code blocks */
427
+ .gradio-container pre {
428
+ background-color: #f8fafc !important;
429
+ border: 1px solid var(--border-color) !important;
430
+ border-radius: 0.5rem !important;
431
+ padding: 1rem !important;
432
+ margin: 1.5rem 0 !important;
433
+ overflow-x: auto !important;
434
+ font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace !important;
435
+ font-size: 0.875rem !important;
436
+ line-height: 1.5rem !important;
437
+ }
438
+
439
+ .gradio-container code {
440
+ background-color: #f1f5f9 !important;
441
+ color: #475569 !important;
442
+ padding: 0.125rem 0.375rem !important;
443
+ border-radius: 0.25rem !important;
444
+ font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace !important;
445
+ font-size: 0.875rem !important;
446
+ }
447
+
448
+ /* Blockquotes */
449
+ .gradio-container blockquote {
450
+ border-left: 4px solid var(--link-color) !important;
451
+ padding-left: 1rem !important;
452
+ margin: 1.5rem 0 !important;
453
+ font-style: italic !important;
454
+ color: #64748b !important;
455
+ }
456
+
457
+ /* Images - add some spacing */
458
+ .gradio-container img {
459
+ margin: 1.5rem 0 !important;
460
+ border-radius: 0.5rem !important;
461
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
462
+ }
463
+
464
+ /* Horizontal rules */
465
+ hr {
466
+ border: none !important;
467
+ border-top: 1px solid var(--border-color) !important;
468
+ margin: 2rem 0 !important;
469
+ }
470
+
471
+ /* Scroll margins for anchor links */
472
+ .section {
473
+ scroll-margin-top: 80px;
474
+ }
475
+
476
+ /* Improve readability with better max-width for text */
477
+ .gradio-container > div > div {
478
+ max-width: 65ch;
479
+ }
480
+
481
+ /* Interactive components styling */
482
+ .gradio-container .gr-form {
483
+ margin: 2rem 0 !important;
484
+ }
485
+
486
+ .gradio-container button {
487
+ font-family: 'Inter', sans-serif !important;
488
+ font-weight: 500 !important;
489
+ }
490
  """
491
 
492
  with gr.Blocks(css=CSS, fill_height=True, title="Interactive Blog — Transformers Feature Showcase") as demo: