Spaces:
Runtime error
Runtime error
Bill Psomas
commited on
Commit
·
0d9faa1
1
Parent(s):
2b1850a
higher resolution choice
Browse files
app.py
CHANGED
|
@@ -46,7 +46,7 @@ msg = model.load_state_dict(state_dict, strict=True)
|
|
| 46 |
model.eval()
|
| 47 |
|
| 48 |
def get_attention_map(img, resolution=32):
|
| 49 |
-
input_size =
|
| 50 |
data_transforms = transforms.Compose([
|
| 51 |
transforms.Resize((input_size, input_size), interpolation=3),
|
| 52 |
transforms.ToTensor(),
|
|
@@ -68,10 +68,9 @@ attention_interface = gr.Interface(
|
|
| 68 |
fn=get_attention_map,
|
| 69 |
inputs=[
|
| 70 |
gr.Image(type="pil", label="Input Image"),
|
| 71 |
-
gr.Dropdown(choices=[
|
| 72 |
label="Attention Map Resolution",
|
| 73 |
-
value=
|
| 74 |
-
type="index")
|
| 75 |
],
|
| 76 |
outputs=gr.Image(type="pil", label="SimPool Attention Map", width=width_display, height=height_display),
|
| 77 |
examples=example_list,
|
|
|
|
| 46 |
model.eval()
|
| 47 |
|
| 48 |
def get_attention_map(img, resolution=32):
|
| 49 |
+
input_size = resolution * 14
|
| 50 |
data_transforms = transforms.Compose([
|
| 51 |
transforms.Resize((input_size, input_size), interpolation=3),
|
| 52 |
transforms.ToTensor(),
|
|
|
|
| 68 |
fn=get_attention_map,
|
| 69 |
inputs=[
|
| 70 |
gr.Image(type="pil", label="Input Image"),
|
| 71 |
+
gr.Dropdown(choices=[16, 32, 64, 128],
|
| 72 |
label="Attention Map Resolution",
|
| 73 |
+
value=32)
|
|
|
|
| 74 |
],
|
| 75 |
outputs=gr.Image(type="pil", label="SimPool Attention Map", width=width_display, height=height_display),
|
| 76 |
examples=example_list,
|