Spaces:
Runtime error
Runtime error
Orpheous1
commited on
Commit
·
523f190
1
Parent(s):
0028cfc
examples
Browse files- app.py +4 -1
- dogcat.jpeg +0 -0
- elephant-zebra.jpg +0 -0
- finch.jpeg +0 -0
app.py
CHANGED
@@ -49,6 +49,7 @@ def draw_heatmap(image, mask):
|
|
49 |
|
50 |
# Define callable method for the demo
|
51 |
def get_mask(image, model_name: str):
|
|
|
52 |
if image is None:
|
53 |
return None, None, None
|
54 |
|
@@ -86,13 +87,15 @@ gr.Interface(
|
|
86 |
get_mask,
|
87 |
inputs=[
|
88 |
gr.inputs.Image(label="Input", shape=(224, 224), source="upload", type="numpy"),
|
89 |
-
gr.inputs.Dropdown(label="Model Name", choices=["DiffMask-
|
90 |
],
|
91 |
outputs=[
|
92 |
gr.outputs.Image(label="Output"),
|
93 |
gr.outputs.Label(label="Original Prediction", num_top_classes=5),
|
94 |
gr.outputs.Label(label="Masked Prediction", num_top_classes=5),
|
95 |
],
|
|
|
|
|
96 |
title="Vision DiffMask Demo",
|
97 |
live=True,
|
98 |
).launch()
|
|
|
49 |
|
50 |
# Define callable method for the demo
|
51 |
def get_mask(image, model_name: str):
|
52 |
+
torch.manual_seed(seed=0)
|
53 |
if image is None:
|
54 |
return None, None, None
|
55 |
|
|
|
87 |
get_mask,
|
88 |
inputs=[
|
89 |
gr.inputs.Image(label="Input", shape=(224, 224), source="upload", type="numpy"),
|
90 |
+
gr.inputs.Dropdown(label="Model Name", choices=["DiffMask-ImageNet", "DiffMask-CIFAR-10"]),
|
91 |
],
|
92 |
outputs=[
|
93 |
gr.outputs.Image(label="Output"),
|
94 |
gr.outputs.Label(label="Original Prediction", num_top_classes=5),
|
95 |
gr.outputs.Label(label="Masked Prediction", num_top_classes=5),
|
96 |
],
|
97 |
+
examples=[["dogcat.jpeg", "DiffMask-ImageNet"], ["elephant-zebra.jpg", "DiffMask-ImageNet"],
|
98 |
+
["finch.jpeg", "DiffMask-ImageNet"]],
|
99 |
title="Vision DiffMask Demo",
|
100 |
live=True,
|
101 |
).launch()
|
dogcat.jpeg
ADDED
![]() |
elephant-zebra.jpg
ADDED
![]() |
finch.jpeg
ADDED
![]() |