Spaces:
Sleeping
Sleeping
hhhhhh0103
commited on
Commit
β’
57d1f06
1
Parent(s):
43e5dc3
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from torch.nn.functional import cosine_similarity
|
|
7 |
import gradio as gr
|
8 |
|
9 |
class RoiMatching():
|
10 |
-
def __init__(self,img1,img2,device='
|
11 |
"""
|
12 |
Initialize
|
13 |
:param img1: PIL image
|
@@ -230,11 +230,11 @@ def predict(im1,im2):
|
|
230 |
visualized_image1, visualized_image2 = visualize_masks(im1, RM.masks1, im2, RM.masks2)
|
231 |
return visualized_image1, visualized_image2
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
# ['./example/pathology/1B_B7_R.png', './example/pathology/1B_B7_T.png'],
|
237 |
-
|
238 |
|
239 |
|
240 |
gradio_app = gr.Interface(
|
@@ -242,7 +242,7 @@ gradio_app = gr.Interface(
|
|
242 |
inputs=[gr.Image(label="img1", type="pil"), gr.Image(label="img2", type="pil")],
|
243 |
outputs=[gr.Image(label="ROIs in img1"), gr.Image(label="ROIs in img2")],
|
244 |
title="SAMReg: One Registration is Worth Two Segmentations",
|
245 |
-
|
246 |
description="<p> \
|
247 |
<strong>Register anything with ROI-based registration representation.</strong> <br>\
|
248 |
Choose an example below 🔥 🔥 🔥 <br>\
|
@@ -253,4 +253,6 @@ gradio_app = gr.Interface(
|
|
253 |
π Examples below are all medical images for the algorithm proposed for medical registration initially. <br>\
|
254 |
π Current UI interface only unleashes a small part of the capabilities of SAMReg, i.e., 2D registration w 'embedding' mode. \
|
255 |
</p>",
|
|
|
|
|
256 |
)
|
|
|
7 |
import gradio as gr
|
8 |
|
9 |
class RoiMatching():
|
10 |
+
def __init__(self,img1,img2,device='cpu', v_min=200, v_max= 7000, mode = 'embedding'):
|
11 |
"""
|
12 |
Initialize
|
13 |
:param img1: PIL image
|
|
|
230 |
visualized_image1, visualized_image2 = visualize_masks(im1, RM.masks1, im2, RM.masks2)
|
231 |
return visualized_image1, visualized_image2
|
232 |
|
233 |
+
examples = [
|
234 |
+
['./example/prostate_2d/image1.png', './example/prostate_2d/image2.png'],
|
235 |
+
['./example/cardiac_2d/image1.png', './example/cardiac_2d/image2.png'],
|
236 |
# ['./example/pathology/1B_B7_R.png', './example/pathology/1B_B7_T.png'],
|
237 |
+
]
|
238 |
|
239 |
|
240 |
gradio_app = gr.Interface(
|
|
|
242 |
inputs=[gr.Image(label="img1", type="pil"), gr.Image(label="img2", type="pil")],
|
243 |
outputs=[gr.Image(label="ROIs in img1"), gr.Image(label="ROIs in img2")],
|
244 |
title="SAMReg: One Registration is Worth Two Segmentations",
|
245 |
+
examples=examples,
|
246 |
description="<p> \
|
247 |
<strong>Register anything with ROI-based registration representation.</strong> <br>\
|
248 |
Choose an example below 🔥 🔥 🔥 <br>\
|
|
|
253 |
π Examples below are all medical images for the algorithm proposed for medical registration initially. <br>\
|
254 |
π Current UI interface only unleashes a small part of the capabilities of SAMReg, i.e., 2D registration w 'embedding' mode. \
|
255 |
</p>",
|
256 |
+
cache_examples=False,
|
257 |
+
allow_flagging="never",
|
258 |
)
|