chris1nexus commited on
Commit
06b65b5
·
1 Parent(s): 29a517e
Files changed (1) hide show
  1. app.py +30 -5
app.py CHANGED
@@ -4,7 +4,7 @@ import os
4
  from streamlit_option_menu import option_menu
5
  import torch
6
 
7
-
8
  @st.cache(suppress_st_warning=True)
9
  def load_model():
10
  from predict import Predictor
@@ -25,7 +25,27 @@ def load_dependencies():
25
 
26
  def main():
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
 
 
 
29
 
30
 
31
 
@@ -46,7 +66,6 @@ def main():
46
  os.environ['GT_WEIGHT_PATH'] = os.path.join(os.environ['WEIGHTS_PATH'], 'graph_transformer', 'GraphCAM.pth')
47
 
48
 
49
- #st.set_page_config(page_title="",layout='wide')
50
  predictor = load_model()#Predictor()
51
 
52
 
@@ -56,10 +75,15 @@ def main():
56
  ABOUT_TEXT = "🤗 LastMinute Medical - Web diagnosis tool."
57
  CONTACT_TEXT = """
58
  _Built by Christian Cancedda and LabLab lads with love_ ❤️
 
59
  [![Follow](https://img.shields.io/github/followers/Chris1nexus?style=social)](https://github.com/Chris1nexus)
 
60
  [![Follow](https://img.shields.io/twitter/follow/chris_cancedda?style=social)](https://twitter.com/intent/follow?screen_name=chris_cancedda)
 
61
  Star project repository:
62
- [![GitHub stars](https://img.shields.io/github/followers/Chris1nexus?style=social)](https://github.com/Chris1nexus/inference-graph-transformer)
 
 
63
  """
64
  VISUALIZE_TEXT = "Visualize WSI slide by uploading it on the provided window"
65
  DETECT_TEXT = "Generate a preliminary diagnosis about the presence of pulmonary disease"
@@ -88,10 +112,11 @@ def main():
88
  }
89
  </style>
90
  <p style='text-align: center'>
91
- <a href="https://github.com/Chris1nexus/inference-graph-transformer" target="_blank">Project Repository</a>
92
  </p>
93
- <p class="aligncenter">
94
 
 
 
95
  <a href="https://github.com/Chris1nexus/inference-graph-transformer" target="_blank">
96
  <img src="https://img.shields.io/github/stars/Chris1nexus/inference-graph-transformer?style=social"/>
97
  </a>
 
4
  from streamlit_option_menu import option_menu
5
  import torch
6
 
7
+ st.set_page_config(page_title="",layout='wide')
8
  @st.cache(suppress_st_warning=True)
9
  def load_model():
10
  from predict import Predictor
 
25
 
26
  def main():
27
 
28
+ # environment variables for the inference api
29
+ os.environ['DATA_DIR'] = 'queries'
30
+ os.environ['PATCHES_DIR'] = os.path.join(os.environ['DATA_DIR'], 'patches')
31
+ os.environ['SLIDES_DIR'] = os.path.join(os.environ['DATA_DIR'], 'slides')
32
+ os.environ['GRAPHCAM_DIR'] = os.path.join(os.environ['DATA_DIR'], 'graphcam_plots')
33
+ os.makedirs(os.environ['GRAPHCAM_DIR'], exist_ok=True)
34
+
35
+
36
+ # manually put the metadata in the metadata folder
37
+ os.environ['CLASS_METADATA'] ='metadata/label_map.pkl'
38
+
39
+ # manually put the desired weights in the weights folder
40
+ os.environ['WEIGHTS_PATH'] = WEIGHTS_PATH='weights'
41
+ os.environ['FEATURE_EXTRACTOR_WEIGHT_PATH'] = os.path.join(os.environ['WEIGHTS_PATH'], 'feature_extractor', 'model.pth')
42
+ os.environ['GT_WEIGHT_PATH'] = os.path.join(os.environ['WEIGHTS_PATH'], 'graph_transformer', 'GraphCAM.pth')
43
+
44
+
45
 
46
+ from predict import Predictor
47
+
48
+
49
 
50
 
51
 
 
66
  os.environ['GT_WEIGHT_PATH'] = os.path.join(os.environ['WEIGHTS_PATH'], 'graph_transformer', 'GraphCAM.pth')
67
 
68
 
 
69
  predictor = load_model()#Predictor()
70
 
71
 
 
75
  ABOUT_TEXT = "🤗 LastMinute Medical - Web diagnosis tool."
76
  CONTACT_TEXT = """
77
  _Built by Christian Cancedda and LabLab lads with love_ ❤️
78
+
79
  [![Follow](https://img.shields.io/github/followers/Chris1nexus?style=social)](https://github.com/Chris1nexus)
80
+
81
  [![Follow](https://img.shields.io/twitter/follow/chris_cancedda?style=social)](https://twitter.com/intent/follow?screen_name=chris_cancedda)
82
+
83
  Star project repository:
84
+
85
+ [![GitHub stars](https://img.shields.io/github/stars/Chris1nexus/inference-graph-transformer?style=social)](https://github.com/Chris1nexus/inference-graph-transformer)
86
+
87
  """
88
  VISUALIZE_TEXT = "Visualize WSI slide by uploading it on the provided window"
89
  DETECT_TEXT = "Generate a preliminary diagnosis about the presence of pulmonary disease"
 
112
  }
113
  </style>
114
  <p style='text-align: center'>
115
+ <a href="https://github.com/Chris1nexus/inference-graph-transformer" target="_blank">Project Repository</a>
116
  </p>
 
117
 
118
+
119
+ <p class="aligncenter">
120
  <a href="https://github.com/Chris1nexus/inference-graph-transformer" target="_blank">
121
  <img src="https://img.shields.io/github/stars/Chris1nexus/inference-graph-transformer?style=social"/>
122
  </a>