m7mdal7aj commited on
Commit
5600c91
1 Parent(s): a812c7b

Update my_model/tabs/run_inference.py

Browse files
Files changed (1) hide show
  1. my_model/tabs/run_inference.py +22 -20
my_model/tabs/run_inference.py CHANGED
@@ -82,26 +82,28 @@ class InferenceRunner(StateManager):
82
 
83
 
84
  st.session_state.button_label = "Reload Model" if self.is_model_loaded() and self.settings_changed else "Load Model"
85
-
86
- if st.session_state.method == "Fine-Tuned Model":
87
- with st.container():
88
- nested_col11, nested_col12 = st.columns([0.5, 0.5])
89
- if nested_col11.button(st.session_state.button_label):
90
- if st.session_state.button_label == "Load Model":
91
- if self.is_model_loaded():
92
- free_gpu_resources()
93
- self.col1.text("Model already loaded and no settings were changed:)")
 
 
 
 
 
94
  else:
95
  free_gpu_resources()
96
- self.load_model()
97
- else:
 
 
 
98
  free_gpu_resources()
99
- self.reload_detection_model()
100
- if nested_col12.button("Force Reload"):
101
- force_reload_model()
102
-
103
- if self.is_model_loaded() and st.session_state.kbvqa.all_models_loaded:
104
- free_gpu_resources()
105
- self.image_qa_app(self.get_model())
106
- else:
107
- self.col1.warning(f'Model using {st.session_state.method} is not deployed yet, will be ready later.')
 
82
 
83
 
84
  st.session_state.button_label = "Reload Model" if self.is_model_loaded() and self.settings_changed else "Load Model"
85
+
86
+ with self.col1:
87
+ if st.session_state.method == "Fine-Tuned Model":
88
+
89
+ with st.container():
90
+ nested_col11, nested_col12 = st.columns([0.5, 0.5])
91
+ if nested_col11.button(st.session_state.button_label):
92
+ if st.session_state.button_label == "Load Model":
93
+ if self.is_model_loaded():
94
+ free_gpu_resources()
95
+ self.col1.text("Model already loaded and no settings were changed:)")
96
+ else:
97
+ free_gpu_resources()
98
+ self.load_model()
99
  else:
100
  free_gpu_resources()
101
+ self.reload_detection_model()
102
+ if nested_col12.button("Force Reload"):
103
+ self.force_reload_model()
104
+
105
+ if self.is_model_loaded() and st.session_state.kbvqa.all_models_loaded:
106
  free_gpu_resources()
107
+ self.image_qa_app(self.get_model())
108
+ else:
109
+ self.col1.warning(f'Model using {st.session_state.method} is not deployed yet, will be ready later.')