taesiri commited on
Commit
bf0e4cf
1 Parent(s): 95a055e

fixed a bug

Browse files
Files changed (3) hide show
  1. .gitignore +174 -0
  2. app.py +12 -15
  3. download_utils.py +2 -2
.gitignore ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Created by https://www.toptal.com/developers/gitignore/api/python
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=python
4
+
5
+ ### Python ###
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ share/python-wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+ MANIFEST
33
+
34
+ # PyInstaller
35
+ # Usually these files are written by a python script from a template
36
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
37
+ *.manifest
38
+ *.spec
39
+
40
+ # Installer logs
41
+ pip-log.txt
42
+ pip-delete-this-directory.txt
43
+
44
+ # Unit test / coverage reports
45
+ htmlcov/
46
+ .tox/
47
+ .nox/
48
+ .coverage
49
+ .coverage.*
50
+ .cache
51
+ nosetests.xml
52
+ coverage.xml
53
+ *.cover
54
+ *.py,cover
55
+ .hypothesis/
56
+ .pytest_cache/
57
+ cover/
58
+
59
+ # Translations
60
+ *.mo
61
+ *.pot
62
+
63
+ # Django stuff:
64
+ *.log
65
+ local_settings.py
66
+ db.sqlite3
67
+ db.sqlite3-journal
68
+
69
+ # Flask stuff:
70
+ instance/
71
+ .webassets-cache
72
+
73
+ # Scrapy stuff:
74
+ .scrapy
75
+
76
+ # Sphinx documentation
77
+ docs/_build/
78
+
79
+ # PyBuilder
80
+ .pybuilder/
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ # For a library or package, you might want to ignore these files since the code is
92
+ # intended to run in multiple environments; otherwise, check them in:
93
+ # .python-version
94
+
95
+ # pipenv
96
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
97
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
98
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
99
+ # install all needed dependencies.
100
+ #Pipfile.lock
101
+
102
+ # poetry
103
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
104
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
105
+ # commonly ignored for libraries.
106
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
107
+ #poetry.lock
108
+
109
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
110
+ __pypackages__/
111
+
112
+ # Celery stuff
113
+ celerybeat-schedule
114
+ celerybeat.pid
115
+
116
+ # SageMath parsed files
117
+ *.sage.py
118
+
119
+ # Environments
120
+ .env
121
+ .venv
122
+ env/
123
+ venv/
124
+ ENV/
125
+ env.bak/
126
+ venv.bak/
127
+
128
+ # Spyder project settings
129
+ .spyderproject
130
+ .spyproject
131
+
132
+ # Rope project settings
133
+ .ropeproject
134
+
135
+ # mkdocs documentation
136
+ /site
137
+
138
+ # mypy
139
+ .mypy_cache/
140
+ .dmypy.json
141
+ dmypy.json
142
+
143
+ # Pyre type checker
144
+ .pyre/
145
+
146
+ # pytype static type analyzer
147
+ .pytype/
148
+
149
+ # Cython debug symbols
150
+ cython_debug/
151
+
152
+ # PyCharm
153
+ # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
154
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
155
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
156
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
157
+ #.idea/
158
+
159
+ # End of https://www.toptal.com/developers/gitignore/api/python
160
+ #
161
+ #
162
+
163
+ ImageNet-HARD-EMD-Real.zip
164
+ demonstrations.zip
165
+ ImageNet-HARD-Normal.zip
166
+ demonstrations/
167
+ visualizations_feb2022/
168
+ ImageNet-HARD-EMD-5-Patches-Real.zip
169
+ visualizations
170
+ imagenet1k-pilot.tar.gz
171
+ predictions/
172
+ imagenet1k-pilot.zip
173
+ Final.zip
174
+ imagenet1k-val-50k-emd_results_rosy-brook-184.pickle
app.py CHANGED
@@ -44,6 +44,18 @@ picklefile_url = "https://static.taesiri.com/xai/Task1_Results_CHM_and_EMD.pickl
44
  prediction_root = "./predictions/"
45
  prediction_pickle = f"{prediction_root}predictions.pickle"
46
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  ################################################
48
  # GLOBAL VARIABLES
49
  app_mode = ""
@@ -73,19 +85,6 @@ session_state = SessionState.get(
73
  ################################################
74
 
75
 
76
- def get_data():
77
- download_files(
78
- root_visualization_dir,
79
- viz_url,
80
- viz_archivefile,
81
- demonstration_url,
82
- demonst_zipfile,
83
- picklefile_url,
84
- prediction_root,
85
- prediction_pickle,
86
- )
87
-
88
-
89
  def resmaple_queries():
90
  if session_state.first_run == 1:
91
  both_correct = glob(
@@ -299,8 +298,6 @@ def main():
299
  global app_mode
300
  global session_state
301
  global selected_xai_tool
302
- # Get the Data
303
- get_data()
304
 
305
  # Set the session state
306
  # State Management and General Setup
 
44
  prediction_root = "./predictions/"
45
  prediction_pickle = f"{prediction_root}predictions.pickle"
46
 
47
+
48
+ # Get the Data
49
+ download_files(
50
+ root_visualization_dir,
51
+ viz_url,
52
+ viz_archivefile,
53
+ demonstration_url,
54
+ demonst_zipfile,
55
+ picklefile_url,
56
+ prediction_root,
57
+ prediction_pickle,
58
+ )
59
  ################################################
60
  # GLOBAL VARIABLES
61
  app_mode = ""
 
85
  ################################################
86
 
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  def resmaple_queries():
89
  if session_state.first_run == 1:
90
  both_correct = glob(
 
298
  global app_mode
299
  global session_state
300
  global selected_xai_tool
 
 
301
 
302
  # Set the session state
303
  # State Management and General Setup
download_utils.py CHANGED
@@ -46,8 +46,8 @@ def download_files(
46
  gdown.download(demonstration_url, demonst_zipfile, quiet=False)
47
  # os.makedirs(roo_demonstration_dir, exist_ok=True)
48
 
49
- with zipfile.ZipFile(demonst_zipfile, "r") as zip_ref:
50
- zip_ref.extractall("./")
51
 
52
  # Get Predictions
53
  if not os.path.exists(prediction_pickle):
 
46
  gdown.download(demonstration_url, demonst_zipfile, quiet=False)
47
  # os.makedirs(roo_demonstration_dir, exist_ok=True)
48
 
49
+ with zipfile.ZipFile(demonst_zipfile, "r") as zip_ref:
50
+ zip_ref.extractall("./")
51
 
52
  # Get Predictions
53
  if not os.path.exists(prediction_pickle):