MuhammadAdil63 commited on
Commit
9a9e768
Β·
1 Parent(s): 113a06f

fix4: torch.load

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -82,6 +82,14 @@ from pathlib import Path
82
 
83
  import gradio as gr
84
  import torch
 
 
 
 
 
 
 
 
85
  import huggingface_hub # noqa: F401 (ensure installed; used in _hf_ckpt)
86
 
87
  # ─────────────────────────────────────────────────────────────────────────────
@@ -1532,7 +1540,7 @@ with gr.Blocks(css=CSS, title="Angio AI") as demo:
1532
  <ol style="font-size:13px;color:#1a2533;line-height:1.9;padding-left:16px">
1533
  <li>Best frame extracted from video</li>
1534
  <li>Stenosis detection β€” Mask2Former</li>
1535
- <li>Coronary segmentation β€” 26-class</li>
1536
  <li>Binary vessel mask β€” ResUNet</li>
1537
  <li>FFR estimation β€” QFR v4</li>
1538
  <li>SYNTAX score computation</li>
@@ -1584,7 +1592,7 @@ with gr.Blocks(css=CSS, title="Angio AI") as demo:
1584
 
1585
  with gr.Row():
1586
  with gr.Column():
1587
- gr.HTML('<div class="card-title" style="margin-bottom:6px">Coronary segmentation </div>')
1588
  seg_out = gr.Image(label="26-class overlay", height=300)
1589
  with gr.Column():
1590
  gr.HTML('<div class="card-title" style="margin-bottom:6px">FFR analysis</div>')
 
82
 
83
  import gradio as gr
84
  import torch
85
+
86
+ # ── Patch torch.load for PyTorch 2.7 (weights_only=True default breaks YOLO) ─
87
+ _orig_tload = torch.load
88
+ def _safe_tload(f, map_location=None, pickle_module=None,
89
+ weights_only=None, mmap=None, **kwargs):
90
+ return _orig_tload(f, map_location=map_location, weights_only=False, **kwargs)
91
+ torch.load = _safe_tload
92
+
93
  import huggingface_hub # noqa: F401 (ensure installed; used in _hf_ckpt)
94
 
95
  # ─────────────────────────────────────────────────────────────────────────────
 
1540
  <ol style="font-size:13px;color:#1a2533;line-height:1.9;padding-left:16px">
1541
  <li>Best frame extracted from video</li>
1542
  <li>Stenosis detection β€” Mask2Former</li>
1543
+ <li>Coronary segmentation β€” YOLOv8m-seg (26-class)</li>
1544
  <li>Binary vessel mask β€” ResUNet</li>
1545
  <li>FFR estimation β€” QFR v4</li>
1546
  <li>SYNTAX score computation</li>
 
1592
 
1593
  with gr.Row():
1594
  with gr.Column():
1595
+ gr.HTML('<div class="card-title" style="margin-bottom:6px">Coronary segmentation (YOLOv8m-seg)</div>')
1596
  seg_out = gr.Image(label="26-class overlay", height=300)
1597
  with gr.Column():
1598
  gr.HTML('<div class="card-title" style="margin-bottom:6px">FFR analysis</div>')