bernardo-de-almeida commited on
Commit
9d8cd89
·
1 Parent(s): f7c9069

fix: deployment

Browse files
Files changed (1) hide show
  1. app.py +184 -20
app.py CHANGED
@@ -22,7 +22,7 @@ HF_TOKEN = (
22
  if HF_TOKEN is None:
23
  raise RuntimeError("Missing Hugging Face token. Set NTV3_HF_TOKEN as a Space Secret.")
24
 
25
- asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
26
 
27
  PLOT_TARGET_POINTS = int(os.environ.get("PLOT_TARGET_POINTS", "1500"))
28
  SEARCH_MAX_RESULTS = int(os.environ.get("SEARCH_MAX_RESULTS", "50"))
@@ -325,18 +325,145 @@ CSS = """
325
  }
326
 
327
  #intro_markdown {
328
- font-size: 1.3em !important;
329
- line-height: 1.7 !important;
 
330
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  #intro_markdown h1 {
332
- font-size: 2.8em !important;
333
- margin-bottom: 0.6em !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
335
- #intro_markdown h2, #intro_markdown h3 {
336
- font-size: 1.8em !important;
 
 
 
 
 
337
  }
338
- #intro_markdown p, #intro_markdown li {
339
- font-size: 1.2em !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  }
341
  """
342
 
@@ -415,18 +542,55 @@ _default_coords = DEFAULT_COORDS.get(DEFAULT_SPECIES, DEFAULT_COORDS["human"])
415
 
416
  with gr.Blocks(title="NTv3 Tracks Demo") as demo:
417
  gr.Markdown(
418
- """
419
- # 🧬 NTv3 Tracks Demo
420
-
421
- **Predict functional genomics tracks and genome annotation elements from DNA sequences using NTv3 (Nucleotide Transformer v3).**
422
-
423
- This demo allows you to:
424
- - **Input**: Provide a DNA sequence directly or specify genomic coordinates (chromosome, start, end)
425
- - **Select tracks**: Choose from hundreds of BigWig functional tracks (e.g., RNA-seq, ChIP-seq, DNase) and genome annotation elements (e.g., exons, introns, promoters)
426
- - **Visualize**: View NTv3 predictions across the input sequence
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  """,
428
- elem_id="intro_markdown",
429
- )
 
430
 
431
  gr.Markdown("## Select NTv3 post-trained model")
432
 
 
22
  if HF_TOKEN is None:
23
  raise RuntimeError("Missing Hugging Face token. Set NTV3_HF_TOKEN as a Space Secret.")
24
 
25
+ # asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
26
 
27
  PLOT_TARGET_POINTS = int(os.environ.get("PLOT_TARGET_POINTS", "1500"))
28
  SEARCH_MAX_RESULTS = int(os.environ.get("SEARCH_MAX_RESULTS", "50"))
 
325
  }
326
 
327
  #intro_markdown {
328
+ max-width: 1200px;
329
+ margin: 0 auto;
330
+ padding: 14px 8px 6px 8px;
331
  }
332
+
333
+ /* overall hero container */
334
+ #intro_markdown .intro-hero {
335
+ border: 1px solid rgba(0,0,0,0.08);
336
+ border-radius: 18px;
337
+ padding: 18px 18px 14px 18px;
338
+ background: linear-gradient(
339
+ 180deg,
340
+ rgba(0, 128, 255, 0.06),
341
+ rgba(0, 0, 0, 0.00)
342
+ );
343
+ }
344
+
345
+ /* badge + title row */
346
+ #intro_markdown .intro-title {
347
+ margin-bottom: 14px;
348
+ }
349
+
350
+ #intro_markdown .intro-badge {
351
+ display: inline-block;
352
+ font-weight: 700;
353
+ font-size: 0.95rem;
354
+ letter-spacing: 0.02em;
355
+ padding: 6px 10px;
356
+ border-radius: 999px;
357
+ background: rgba(0,0,0,0.06);
358
+ margin-bottom: 10px;
359
+ }
360
+
361
  #intro_markdown h1 {
362
+ font-size: 2.25rem !important;
363
+ line-height: 1.1 !important;
364
+ margin: 0 0 8px 0 !important;
365
+ }
366
+
367
+ #intro_markdown .intro-subtitle {
368
+ font-size: 1.05rem !important;
369
+ line-height: 1.6 !important;
370
+ margin: 0 !important;
371
+ opacity: 0.9;
372
+ }
373
+
374
+ /* grid of cards */
375
+ #intro_markdown .intro-grid {
376
+ display: grid;
377
+ grid-template-columns: repeat(3, minmax(0, 1fr));
378
+ gap: 12px;
379
+ margin-top: 14px;
380
+ }
381
+
382
+ /* cards */
383
+ #intro_markdown .intro-card {
384
+ border: 1px solid rgba(56, 189, 248, 0.18); /* sky accent */
385
+ border-radius: 16px;
386
+ padding: 14px 14px 12px 14px;
387
+
388
+ /* dark glass */
389
+ background: linear-gradient(
390
+ 180deg,
391
+ rgba(15, 23, 42, 0.72),
392
+ rgba(15, 23, 42, 0.55)
393
+ );
394
+
395
+ box-shadow:
396
+ 0 10px 30px rgba(0, 0, 0, 0.35),
397
+ inset 0 1px 0 rgba(255, 255, 255, 0.06);
398
+
399
+ backdrop-filter: blur(10px);
400
+ -webkit-backdrop-filter: blur(10px);
401
+
402
+ transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
403
  }
404
+
405
+ #intro_markdown .intro-card:hover {
406
+ transform: translateY(-2px);
407
+ border-color: rgba(56, 189, 248, 0.38);
408
+ box-shadow:
409
+ 0 14px 36px rgba(0, 0, 0, 0.42),
410
+ inset 0 1px 0 rgba(255, 255, 255, 0.08);
411
  }
412
+
413
+ #intro_markdown .intro-card h3 {
414
+ font-size: 1.05rem !important;
415
+ margin: 0 0 8px 0 !important;
416
+ color: rgba(255, 255, 255, 0.95);
417
+ letter-spacing: 0.01em;
418
+ }
419
+
420
+ #intro_markdown .intro-card li {
421
+ font-size: 0.98rem !important;
422
+ line-height: 1.55 !important;
423
+ margin: 6px 0;
424
+ color: rgba(255, 255, 255, 0.82);
425
+ }
426
+
427
+ #intro_markdown .intro-card li::marker {
428
+ color: rgba(56, 189, 248, 0.75);
429
+ }
430
+
431
+ #intro_markdown .intro-card em,
432
+ #intro_markdown .intro-card strong {
433
+ color: rgba(255, 255, 255, 0.92);
434
+ }
435
+
436
+ /* tip callout */
437
+ #intro_markdown .intro-tip {
438
+ margin-top: 14px;
439
+ display: flex;
440
+ gap: 10px;
441
+ align-items: flex-start;
442
+ padding: 10px 12px;
443
+ border-radius: 14px;
444
+ background: rgba(0, 128, 255, 0.08);
445
+ border: 1px solid rgba(0, 128, 255, 0.18);
446
+ }
447
+
448
+ #intro_markdown .intro-tip-icon {
449
+ font-size: 1.2rem;
450
+ line-height: 1;
451
+ margin-top: 1px;
452
+ }
453
+
454
+ #intro_markdown .intro-tip span {
455
+ font-size: 0.98rem !important;
456
+ line-height: 1.55 !important;
457
+ }
458
+
459
+ /* responsive */
460
+ @media (max-width: 960px) {
461
+ #intro_markdown .intro-grid {
462
+ grid-template-columns: 1fr;
463
+ }
464
+ #intro_markdown h1 {
465
+ font-size: 2.0rem !important;
466
+ }
467
  }
468
  """
469
 
 
542
 
543
  with gr.Blocks(title="NTv3 Tracks Demo") as demo:
544
  gr.Markdown(
545
+ """
546
+ <div class="intro-hero">
547
+
548
+ <div class="intro-title">
549
+ <h1>🧬 NTv3 Tracks Demo</h1>
550
+ <p class="intro-subtitle">
551
+ Predict and visualize functional genomics signals directly from DNA using
552
+ <strong>Nucleotide Transformer v3</strong>.
553
+ </p>
554
+ </div>
555
+
556
+ <div class="intro-grid">
557
+ <div class="intro-card">
558
+ <h3>1) Provide input</h3>
559
+ <ul>
560
+ <li>Select a <strong>model</strong> and <strong>species</strong></li>
561
+ <li>Use genomic coordinates (chrom, start, end), <em>or</em></li>
562
+ <li>Paste a DNA sequence</li>
563
+ </ul>
564
+ </div>
565
+
566
+ <div class="intro-card">
567
+ <h3>2) Choose signals</h3>
568
+ <ul>
569
+ <li>Search & select <strong>BigWig functional tracks</strong> (RNA-seq, ChIP-seq, DNase…)</li>
570
+ <li>Select <strong>BED genome annotation elements</strong> (exons, introns, promoters…)</li>
571
+ </ul>
572
+ </div>
573
+
574
+ <div class="intro-card">
575
+ <h3>3) Explore</h3>
576
+ <ul>
577
+ <li>View stacked tracks across the region</li>
578
+ <li>Compare multiple signals side-by-side</li>
579
+ <li>Download a high-resolution PNG from the plot</li>
580
+ </ul>
581
+ </div>
582
+ </div>
583
+
584
+ <div class="intro-tip">
585
+ <span class="intro-tip-icon">💡</span>
586
+ <span><strong>Tip:</strong> Start typing in the BigWig search box — results update as you type. Click any result to add it.</span>
587
+ </div>
588
+
589
+ </div>
590
  """,
591
+ elem_id="intro_markdown",
592
+ )
593
+
594
 
595
  gr.Markdown("## Select NTv3 post-trained model")
596