lmoss commited on
Commit
07965f0
·
1 Parent(s): cd2924d

didnt fix seems like runtime issues, also caching checkpoint now

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -104,7 +104,8 @@ def main():
104
  model_fname = "berea_generator_epoch_24.pth"
105
  checkpoint_url = "https://github.com/LukasMosser/PorousMediaGan/blob/master/checkpoints/berea/{0:}?raw=true".format(model_fname)
106
 
107
- download_checkpoint(checkpoint_url, (DOWNLOADS_PATH / model_fname))
 
108
 
109
  latent_size = st.slider("Latent Space Size z", min_value=1, max_value=5, step=1)
110
  img = generate_image((DOWNLOADS_PATH / model_fname), latent_size=latent_size)
@@ -125,8 +126,6 @@ def main():
125
  fig = create_matplotlib_figure(img, img.shape[0]//2)
126
  st.pyplot(fig=fig)
127
 
128
-
129
-
130
  HtmlFile = open((DOWNLOADS_PATH / 'slices.html'), 'r', encoding='utf-8')
131
  source_code = HtmlFile.read()
132
  st.header("3D Intersections")
@@ -151,8 +150,6 @@ def main():
151
  }```
152
  """)
153
 
154
- #os.remove("slices.html")
155
- #os.remove("mesh.html")
156
 
157
  if __name__ == "__main__":
158
- main()
 
104
  model_fname = "berea_generator_epoch_24.pth"
105
  checkpoint_url = "https://github.com/LukasMosser/PorousMediaGan/blob/master/checkpoints/berea/{0:}?raw=true".format(model_fname)
106
 
107
+ if not (DOWNLOADS_PATH / model_fname).exists():
108
+ download_checkpoint(checkpoint_url, (DOWNLOADS_PATH / model_fname))
109
 
110
  latent_size = st.slider("Latent Space Size z", min_value=1, max_value=5, step=1)
111
  img = generate_image((DOWNLOADS_PATH / model_fname), latent_size=latent_size)
 
126
  fig = create_matplotlib_figure(img, img.shape[0]//2)
127
  st.pyplot(fig=fig)
128
 
 
 
129
  HtmlFile = open((DOWNLOADS_PATH / 'slices.html'), 'r', encoding='utf-8')
130
  source_code = HtmlFile.read()
131
  st.header("3D Intersections")
 
150
  }```
151
  """)
152
 
 
 
153
 
154
  if __name__ == "__main__":
155
+ main()