czyoung commited on
Commit
d76c23f
·
verified ·
1 Parent(s): 73b143a

Fix GPU checker, set pipeline to only load once

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -62,9 +62,10 @@ MULTI_DEMO_PATHS = [
62
 
63
  torch.classes.__path__ = [os.path.join(torch.__path__[0], torch.classes.__file__)]
64
 
65
- pipeline = Sonogram()
66
- st.session_state.pipeline = pipeline
67
-
 
68
  # ---------------------------------------------------------------------------
69
  # Session state + global styles
70
  # ---------------------------------------------------------------------------
@@ -92,7 +93,7 @@ st.markdown(
92
  # ---------------------------------------------------------------------------
93
 
94
  st.title("Instructor Support Tool")
95
- if not isGPU:
96
  st.warning("TOOL CURRENTLY USING CPU, ANALYSIS EXTREMELY SLOW")
97
 
98
  DEMO_VIDEO_URL = "https://www.youtube.com/watch?v=n7Z_BzU7yOY"
 
62
 
63
  torch.classes.__path__ = [os.path.join(torch.__path__[0], torch.classes.__file__)]
64
 
65
+ if "pipeline" not in st.session_state or st.session_state.pipeline is None:
66
+ pipeline = Sonogram()
67
+ st.session_state.pipeline = pipeline
68
+ pipeline = st.session_state.pipeline
69
  # ---------------------------------------------------------------------------
70
  # Session state + global styles
71
  # ---------------------------------------------------------------------------
 
93
  # ---------------------------------------------------------------------------
94
 
95
  st.title("Instructor Support Tool")
96
+ if not (pipeline.isGPU or pipeline.isTPU):
97
  st.warning("TOOL CURRENTLY USING CPU, ANALYSIS EXTREMELY SLOW")
98
 
99
  DEMO_VIDEO_URL = "https://www.youtube.com/watch?v=n7Z_BzU7yOY"