Update my_model/tabs/run_inference.py
Browse files- my_model/tabs/run_inference.py +13 -10
my_model/tabs/run_inference.py
CHANGED
@@ -88,8 +88,8 @@ class InferenceRunner(StateManager):
|
|
88 |
st.session_state['loading_in_progress'] = False
|
89 |
|
90 |
# Display Q&A history for each image
|
91 |
-
for q, a in qa_history:
|
92 |
-
nested_col22.text(f"Q: {q}\nA: {a}\n")
|
93 |
|
94 |
def display_message(self, message, warning=False, write=False, text=False):
|
95 |
pass
|
@@ -97,11 +97,7 @@ class InferenceRunner(StateManager):
|
|
97 |
|
98 |
|
99 |
|
100 |
-
|
101 |
-
@st.experimental_memo(show_spinner=False)
|
102 |
-
def trigger_rerun(self):
|
103 |
-
pass # No need for any specific code here
|
104 |
-
|
105 |
|
106 |
|
107 |
|
@@ -111,11 +107,11 @@ class InferenceRunner(StateManager):
|
|
111 |
|
112 |
|
113 |
if st.button("Re-run App"):
|
114 |
-
|
115 |
else:
|
116 |
# Trigger re-run every 5 seconds (example)
|
117 |
if time.time() - st.session_state.get("last_rerun", 0) > 5:
|
118 |
-
|
119 |
st.session_state["last_rerun"] = time.time()
|
120 |
|
121 |
|
@@ -193,4 +189,11 @@ class InferenceRunner(StateManager):
|
|
193 |
self.image_qa_app(self.get_model())
|
194 |
st.write('load success', 'loading in prog?', st.session_state['loading_in_progress'])
|
195 |
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
st.session_state['loading_in_progress'] = False
|
89 |
|
90 |
# Display Q&A history for each image
|
91 |
+
for num, (q, a) in enumerate(qa_history):
|
92 |
+
nested_col22.text(f"Q{num+1}: {q}\nA{num+1}: {a}\n")
|
93 |
|
94 |
def display_message(self, message, warning=False, write=False, text=False):
|
95 |
pass
|
|
|
97 |
|
98 |
|
99 |
|
100 |
+
|
|
|
|
|
|
|
|
|
101 |
|
102 |
|
103 |
|
|
|
107 |
|
108 |
|
109 |
if st.button("Re-run App"):
|
110 |
+
trigger_rerun(None) # Force a re-run
|
111 |
else:
|
112 |
# Trigger re-run every 5 seconds (example)
|
113 |
if time.time() - st.session_state.get("last_rerun", 0) > 5:
|
114 |
+
trigger_rerun(None)
|
115 |
st.session_state["last_rerun"] = time.time()
|
116 |
|
117 |
|
|
|
189 |
self.image_qa_app(self.get_model())
|
190 |
st.write('load success', 'loading in prog?', st.session_state['loading_in_progress'])
|
191 |
|
192 |
+
|
193 |
+
|
194 |
+
|
195 |
+
|
196 |
+
|
197 |
+
@st.experimental_memo(show_spinner=False)
|
198 |
+
def trigger_rerun():
|
199 |
+
pass # No need for any specific code here
|