chris1nexus commited on
Commit
8a89a15
1 Parent(s): ad1b20c

Update app

Browse files
Files changed (2) hide show
  1. app.py +9 -3
  2. requirements.txt +8 -5
app.py CHANGED
@@ -3,12 +3,16 @@ import openslide
3
  import os
4
  from streamlit_option_menu import option_menu
5
  import torch
 
6
 
7
-
 
 
 
8
 
9
  def main():
10
 
11
- from predict import Predictor
12
 
13
 
14
 
@@ -30,7 +34,7 @@ def main():
30
 
31
 
32
  st.set_page_config(page_title="",layout='wide')
33
- predictor = Predictor()
34
 
35
 
36
 
@@ -150,6 +154,7 @@ def main():
150
  st.markdown(CONTACT_TEXT)
151
 
152
  if __name__ == '__main__':
 
153
  if torch.cuda.is_available():
154
  os.system("pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.1+cu113.html")
155
  os.system("pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.1+cu113.html")
@@ -158,4 +163,5 @@ if __name__ == '__main__':
158
  os.system("pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.1+cpu.html")
159
  os.system("pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.1+cpu.html")
160
  os.system("pip install torch-geometric -f https://pytorch-geometric.com/whl/torch-1.7.1+cpu.html")
 
161
  main()
 
3
  import os
4
  from streamlit_option_menu import option_menu
5
  import torch
6
+ from predict import Predictor
7
 
8
+ @st.cache(suppress_st_warning=True)
9
+ def load_model():
10
+ predictor = Predictor()
11
+ return predictor
12
 
13
  def main():
14
 
15
+
16
 
17
 
18
 
 
34
 
35
 
36
  st.set_page_config(page_title="",layout='wide')
37
+ predictor = load_model()#Predictor()
38
 
39
 
40
 
 
154
  st.markdown(CONTACT_TEXT)
155
 
156
  if __name__ == '__main__':
157
+ '''
158
  if torch.cuda.is_available():
159
  os.system("pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.1+cu113.html")
160
  os.system("pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.1+cu113.html")
 
163
  os.system("pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.7.1+cpu.html")
164
  os.system("pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.1+cpu.html")
165
  os.system("pip install torch-geometric -f https://pytorch-geometric.com/whl/torch-1.7.1+cpu.html")
166
+ '''
167
  main()
requirements.txt CHANGED
@@ -3,12 +3,15 @@ streamlit
3
  #-f https://download.pytorch.org/whl/cpu/torch_stable.html
4
  #-f https://data.pyg.org/whl/torch-1.7.1+cpu.html
5
  #torch==1.7.1+cpu
6
- -f https://download.pytorch.org/whl/torch_stable.html
7
- -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
8
- torch==1.10.0+cu113
 
 
 
9
  torchvision
10
- #torch-scatter
11
- #torch-sparse
12
 
13
  einops
14
  streamlit-option-menu
 
3
  #-f https://download.pytorch.org/whl/cpu/torch_stable.html
4
  #-f https://data.pyg.org/whl/torch-1.7.1+cpu.html
5
  #torch==1.7.1+cpu
6
+
7
+ #-f https://download.pytorch.org/whl/torch_stable.html
8
+ #-f https://data.pyg.org/whl/torch-1.10.0+cu113.html
9
+ #torch==1.10.0+cu113
10
+
11
+ torch
12
  torchvision
13
+ torch-scatter
14
+ torch-sparse
15
 
16
  einops
17
  streamlit-option-menu