m7mdal7aj commited on
Commit
6d4d5ac
1 Parent(s): d3129c8

Update my_model/state_manager.py

Browse files
Files changed (1) hide show
  1. my_model/state_manager.py +6 -6
my_model/state_manager.py CHANGED
@@ -4,6 +4,9 @@ import streamlit as st
4
  from my_model.utilities.gen_utilities import free_gpu_resources
5
  from my_model.KBVQA import KBVQA, prepare_kbvqa_model
6
 
 
 
 
7
 
8
  class StateManager:
9
 
@@ -22,9 +25,6 @@ class StateManager:
22
 
23
 
24
  def set_up_widgets(self):
25
-
26
- # Create two columns with different widths
27
- col1, col2, col3 = st.columns([0.2, 0.6, 0.2]) # Adjust the ratio as needed
28
 
29
  with col1:
30
  st.selectbox("Choose a method:", ["Fine-Tuned Model", "In-Context Learning (n-shots)"], index=0, key='method')
@@ -79,8 +79,8 @@ class StateManager:
79
  st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
80
 
81
  st.session_state['button_label'] = "Reload Model"
82
- st.text('button changed')
83
- self.has_state_changed()
84
  free_gpu_resources()
85
  except Exception as e:
86
  st.error(f"Error loading model: {e}")
@@ -109,7 +109,7 @@ class StateManager:
109
  if self.is_model_loaded():
110
  prepare_kbvqa_model(only_reload_detection_model=True)
111
  st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
112
- st.success("Model reloaded with updated settings and ready for inference.")
113
  free_gpu_resources()
114
  except Exception as e:
115
  st.error(f"Error reloading detection model: {e}")
 
4
  from my_model.utilities.gen_utilities import free_gpu_resources
5
  from my_model.KBVQA import KBVQA, prepare_kbvqa_model
6
 
7
+ # Create two columns with different widths
8
+ col1, col2, col3 = st.columns([0.2, 0.6, 0.2])
9
+
10
 
11
  class StateManager:
12
 
 
25
 
26
 
27
  def set_up_widgets(self):
 
 
 
28
 
29
  with col1:
30
  st.selectbox("Choose a method:", ["Fine-Tuned Model", "In-Context Learning (n-shots)"], index=0, key='method')
 
79
  st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
80
 
81
  st.session_state['button_label'] = "Reload Model"
82
+ #st.text('button changed')
83
+ #self.has_state_changed()
84
  free_gpu_resources()
85
  except Exception as e:
86
  st.error(f"Error loading model: {e}")
 
109
  if self.is_model_loaded():
110
  prepare_kbvqa_model(only_reload_detection_model=True)
111
  st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
112
+ col1.success("Model reloaded with updated settings and ready for inference.")
113
  free_gpu_resources()
114
  except Exception as e:
115
  st.error(f"Error reloading detection model: {e}")