Spaces:
Sleeping
Sleeping
Update my_model/state_manager.py
Browse files
my_model/state_manager.py
CHANGED
|
@@ -144,6 +144,13 @@ class StateManager:
|
|
| 144 |
def get_images_data(self):
|
| 145 |
return st.session_state['images_data']
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
def update_image_data(self, image_key, caption, detected_objects_str, analysis_done):
|
| 149 |
if image_key in st.session_state['images_data']:
|
|
|
|
| 144 |
def get_images_data(self):
|
| 145 |
return st.session_state['images_data']
|
| 146 |
|
| 147 |
+
@staticmethod
|
| 148 |
+
def resize_image(image_path, new_width, new_height):
|
| 149 |
+
"""Resize an image to the specified width and height."""
|
| 150 |
+
image = Image.open(image_path)
|
| 151 |
+
resized_image = image.resize((new_width, new_height), Image.ANTIALIAS)
|
| 152 |
+
return resized_image
|
| 153 |
+
|
| 154 |
|
| 155 |
def update_image_data(self, image_key, caption, detected_objects_str, analysis_done):
|
| 156 |
if image_key in st.session_state['images_data']:
|