McClain Claude Opus 4.6 commited on
Commit
3cc4ebb
·
1 Parent(s): 74ad07d

Fix GPU detection and bokeh plasmid map rendering

Browse files

- Remove --extra-index-url for CPU torch — was forcing CPU-only install on
T4 GPU machine, causing device=cpu
- Fix bokeh map: wrap file_html output in iframe with srcdoc so the full
HTML document renders inside Gradio's gr.HTML component

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +9 -1
  2. requirements.txt +0 -1
app.py CHANGED
@@ -654,7 +654,15 @@ def _annotate(dna: str) -> tuple[str | None, pd.DataFrame | None, str]:
654
  html_map = None
655
  try:
656
  fig = _plannotate_bokeh(hits, linear=False)
657
- html_map = file_html(fig, BOKEH_CDN, "Plasmid Map")
 
 
 
 
 
 
 
 
658
  except Exception as exc:
659
  print(f"[annotate] bokeh error: {exc}")
660
 
 
654
  html_map = None
655
  try:
656
  fig = _plannotate_bokeh(hits, linear=False)
657
+ raw_html = file_html(fig, BOKEH_CDN, "Plasmid Map")
658
+ # Wrap in iframe so the full HTML doc renders inside Gradio
659
+ import html as _html_mod
660
+ escaped = _html_mod.escape(raw_html)
661
+ html_map = (
662
+ f'<iframe srcdoc="{escaped}" '
663
+ f'style="width:100%;height:600px;border:none;" '
664
+ f'sandbox="allow-scripts allow-same-origin"></iframe>'
665
+ )
666
  except Exception as exc:
667
  print(f"[annotate] bokeh error: {exc}")
668
 
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
- --extra-index-url https://download.pytorch.org/whl/cpu
2
  torch
3
  transformers>=4.38,<5
4
  accelerate>=0.26
 
 
1
  torch
2
  transformers>=4.38,<5
3
  accelerate>=0.26