Spaces:
Running
Running
Update my_model/state_manager.py
Browse files
my_model/state_manager.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import pandas as pd
|
2 |
import copy
|
|
|
3 |
from PIL import Image
|
4 |
import streamlit as st
|
5 |
from my_model.utilities.gen_utilities import free_gpu_resources
|
@@ -33,6 +34,8 @@ class StateManager:
|
|
33 |
st.session_state['load_button_clicked'] = False
|
34 |
if 'force_reload_button_clicked' not in st.session_state:
|
35 |
st.session_state['force_reload_button_clicked'] = False
|
|
|
|
|
36 |
|
37 |
|
38 |
|
@@ -100,7 +103,7 @@ class StateManager:
|
|
100 |
Uses formatted HTML to style the table for better readability.
|
101 |
"""
|
102 |
self.col3.write("##### Current Model Settings:")
|
103 |
-
data = [{'Setting': key, 'Value': str(value)} for key, value in st.session_state.items() if key in ["confidence_level", 'detection_model', 'method', 'kbvqa', 'previous_state', 'settings_changed', 'loading_in_progress', 'model_loaded' ]]
|
104 |
df = pd.DataFrame(data)
|
105 |
styled_df = df.style.set_properties(**{'background-color': 'white', 'color': 'black', 'border-color': 'black'}).set_table_styles([{'selector': 'th','props': [('background-color', 'gray'), ('font-weight', 'bold')]}])
|
106 |
self.col3.write(df)
|
@@ -129,7 +132,6 @@ class StateManager:
|
|
129 |
"""
|
130 |
|
131 |
try:
|
132 |
-
|
133 |
free_gpu_resources()
|
134 |
st.session_state['kbvqa'] = prepare_kbvqa_model()
|
135 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
|
|
1 |
import pandas as pd
|
2 |
import copy
|
3 |
+
import time
|
4 |
from PIL import Image
|
5 |
import streamlit as st
|
6 |
from my_model.utilities.gen_utilities import free_gpu_resources
|
|
|
34 |
st.session_state['load_button_clicked'] = False
|
35 |
if 'force_reload_button_clicked' not in st.session_state:
|
36 |
st.session_state['force_reload_button_clicked'] = False
|
37 |
+
if 'time_taken_to_load_model' not in st.session_state:
|
38 |
+
st.session_state['time_taken_to_load_model'] = 0
|
39 |
|
40 |
|
41 |
|
|
|
103 |
Uses formatted HTML to style the table for better readability.
|
104 |
"""
|
105 |
self.col3.write("##### Current Model Settings:")
|
106 |
+
data = [{'Setting': key, 'Value': str(value)} for key, value in st.session_state.items() if key in ["confidence_level", 'detection_model', 'method', 'kbvqa', 'previous_state', 'settings_changed', 'loading_in_progress', 'model_loaded', 'time_taken_to_load_model' ]]
|
107 |
df = pd.DataFrame(data)
|
108 |
styled_df = df.style.set_properties(**{'background-color': 'white', 'color': 'black', 'border-color': 'black'}).set_table_styles([{'selector': 'th','props': [('background-color', 'gray'), ('font-weight', 'bold')]}])
|
109 |
self.col3.write(df)
|
|
|
132 |
"""
|
133 |
|
134 |
try:
|
|
|
135 |
free_gpu_resources()
|
136 |
st.session_state['kbvqa'] = prepare_kbvqa_model()
|
137 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|