Spaces:
Runtime error
Runtime error
Bill Psomas
commited on
Commit
Β·
151915d
1
Parent(s):
aeb9733
update demo
Browse files- .gitignore +2 -1
- app.py +9 -26
.gitignore
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
produce_attmaps.py
|
2 |
-
__pycache__
|
|
|
|
1 |
produce_attmaps.py
|
2 |
+
__pycache__
|
3 |
+
flagged/
|
app.py
CHANGED
@@ -1,33 +1,16 @@
|
|
1 |
import os
|
2 |
-
import PIL
|
3 |
-
import ast
|
4 |
-
import cv2
|
5 |
-
import json
|
6 |
-
import torch
|
7 |
-
import pickle
|
8 |
-
import torchvision
|
9 |
import numpy as np
|
10 |
import gradio as gr
|
11 |
-
from PIL import Image
|
12 |
-
from typing import Tuple, Dict
|
13 |
import matplotlib.pyplot as plt
|
14 |
-
from timeit import default_timer as timer
|
15 |
-
from torchvision import datasets, transforms
|
16 |
-
|
17 |
-
import vision_transformer as vits
|
18 |
|
19 |
-
|
20 |
-
import
|
21 |
-
warnings.filterwarnings('ignore')
|
22 |
-
|
23 |
-
example_list = [["examples/" + example] for example in os.listdir("examples")]
|
24 |
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
|
29 |
-
from capture_weights import vit_weights
|
30 |
-
'''
|
31 |
|
32 |
arch = "vit_small"
|
33 |
mode = "simpool"
|
@@ -40,8 +23,8 @@ checkpoint_key = "teacher"
|
|
40 |
|
41 |
cm = plt.get_cmap('viridis')
|
42 |
attn_map_size = 224
|
43 |
-
width_display =
|
44 |
-
height_display =
|
45 |
|
46 |
example_dir = "examples/"
|
47 |
example_list = [[example_dir + example] for example in os.listdir(example_dir)]
|
@@ -96,4 +79,4 @@ demo = gr.TabbedInterface([attention_interface],
|
|
96 |
["Visualize Attention Maps"], title="SimPool Attention Map Visualizer π")
|
97 |
|
98 |
if __name__ == "__main__":
|
99 |
-
demo.launch()
|
|
|
1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import numpy as np
|
3 |
import gradio as gr
|
|
|
|
|
4 |
import matplotlib.pyplot as plt
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
import PIL
|
7 |
+
from PIL import Image
|
|
|
|
|
|
|
8 |
|
9 |
+
import torch
|
10 |
+
import torchvision
|
11 |
+
from torchvision import datasets, transforms
|
12 |
|
13 |
+
import vision_transformer as vits
|
|
|
|
|
14 |
|
15 |
arch = "vit_small"
|
16 |
mode = "simpool"
|
|
|
23 |
|
24 |
cm = plt.get_cmap('viridis')
|
25 |
attn_map_size = 224
|
26 |
+
width_display = 290
|
27 |
+
height_display = 290
|
28 |
|
29 |
example_dir = "examples/"
|
30 |
example_list = [[example_dir + example] for example in os.listdir(example_dir)]
|
|
|
79 |
["Visualize Attention Maps"], title="SimPool Attention Map Visualizer π")
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
+
demo.launch(share=True)
|