Spaces:
Sleeping
Sleeping
Update my_model/state_manager.py
Browse files
my_model/state_manager.py
CHANGED
|
@@ -246,7 +246,7 @@ class StateManager:
|
|
| 246 |
st.error(f"Error reloading detection model: {e}")
|
| 247 |
|
| 248 |
|
| 249 |
-
def process_new_image(self, image_key, image
|
| 250 |
"""
|
| 251 |
Processes a new uploaded image by creating an entry in the `images_data` dictionary in the application session state.
|
| 252 |
|
|
@@ -273,7 +273,7 @@ class StateManager:
|
|
| 273 |
}
|
| 274 |
|
| 275 |
|
| 276 |
-
def analyze_image(self, image
|
| 277 |
"""
|
| 278 |
Analyzes the image using the KBVQA model.
|
| 279 |
|
|
@@ -291,8 +291,8 @@ class StateManager:
|
|
| 291 |
"""
|
| 292 |
img = copy.deepcopy(image)
|
| 293 |
st.text("Analyzing the image .. ")
|
| 294 |
-
caption = kbvqa.get_caption(img)
|
| 295 |
-
image_with_boxes, detected_objects_str = kbvqa.detect_objects(img)
|
| 296 |
return caption, detected_objects_str, image_with_boxes
|
| 297 |
|
| 298 |
|
|
|
|
| 246 |
st.error(f"Error reloading detection model: {e}")
|
| 247 |
|
| 248 |
|
| 249 |
+
def process_new_image(self, image_key, image):
|
| 250 |
"""
|
| 251 |
Processes a new uploaded image by creating an entry in the `images_data` dictionary in the application session state.
|
| 252 |
|
|
|
|
| 273 |
}
|
| 274 |
|
| 275 |
|
| 276 |
+
def analyze_image(self, image):
|
| 277 |
"""
|
| 278 |
Analyzes the image using the KBVQA model.
|
| 279 |
|
|
|
|
| 291 |
"""
|
| 292 |
img = copy.deepcopy(image)
|
| 293 |
st.text("Analyzing the image .. ")
|
| 294 |
+
caption = self.session_state.kbvqa.get_caption(img)
|
| 295 |
+
image_with_boxes, detected_objects_str = self.session_state.kbvqa.detect_objects(img)
|
| 296 |
return caption, detected_objects_str, image_with_boxes
|
| 297 |
|
| 298 |
|