Update my_model/utilities/state_manager.py
Browse files
my_model/utilities/state_manager.py
CHANGED
@@ -31,9 +31,11 @@ class StateManager:
|
|
31 |
st.session_state['model_settings']['selected_method'] != current_selected_method)
|
32 |
|
33 |
def display_model_settings(self):
|
34 |
-
st.write("
|
35 |
data = [{'Key': key, 'Value': str(value)} for key, value in st.session_state.items() if key in ["confidence_level", 'detection_model', 'method', 'kbvqa']]
|
36 |
-
|
|
|
|
|
37 |
|
38 |
def display_session_state(self):
|
39 |
st.write("Current Model:")
|
@@ -47,7 +49,6 @@ class StateManager:
|
|
47 |
free_gpu_resources()
|
48 |
st.text("Loading the model, this should take no more than a few minutes, please wait...")
|
49 |
st.session_state['kbvqa'] = prepare_kbvqa_model()
|
50 |
-
st.text("AAAAAAA")
|
51 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
52 |
#self.update_model_settings(detection_model, confidence_level)
|
53 |
# Update the previous state with current session state values
|
@@ -95,6 +96,7 @@ class StateManager:
|
|
95 |
|
96 |
def analyze_image(self, image, kbvqa):
|
97 |
img = copy.deepcopy(image)
|
|
|
98 |
caption = kbvqa.get_caption(img)
|
99 |
image_with_boxes, detected_objects_str = kbvqa.detect_objects(img)
|
100 |
return caption, detected_objects_str, image_with_boxes
|
|
|
31 |
st.session_state['model_settings']['selected_method'] != current_selected_method)
|
32 |
|
33 |
def display_model_settings(self):
|
34 |
+
st.write("#### Current Model Settings:")
|
35 |
data = [{'Key': key, 'Value': str(value)} for key, value in st.session_state.items() if key in ["confidence_level", 'detection_model', 'method', 'kbvqa']]
|
36 |
+
df = pd.DataFrame(data)
|
37 |
+
styled_df = df.style.set_properties(**{'background-color': 'black', 'color': 'lime', 'border-color': 'white'})
|
38 |
+
st.table(styled_df)
|
39 |
|
40 |
def display_session_state(self):
|
41 |
st.write("Current Model:")
|
|
|
49 |
free_gpu_resources()
|
50 |
st.text("Loading the model, this should take no more than a few minutes, please wait...")
|
51 |
st.session_state['kbvqa'] = prepare_kbvqa_model()
|
|
|
52 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
53 |
#self.update_model_settings(detection_model, confidence_level)
|
54 |
# Update the previous state with current session state values
|
|
|
96 |
|
97 |
def analyze_image(self, image, kbvqa):
|
98 |
img = copy.deepcopy(image)
|
99 |
+
st.text("Analyzing the image .. ")
|
100 |
caption = kbvqa.get_caption(img)
|
101 |
image_with_boxes, detected_objects_str = kbvqa.detect_objects(img)
|
102 |
return caption, detected_objects_str, image_with_boxes
|