Spaces:
Sleeping
Sleeping
Update my_model/tabs/run_inference.py
Browse files
my_model/tabs/run_inference.py
CHANGED
|
@@ -35,8 +35,9 @@ class InferenceRunner(StateManager):
|
|
| 35 |
for idx, sample_image_path in enumerate(self.sample_images):
|
| 36 |
with cols[idx]:
|
| 37 |
image = Image.open(sample_image_path)
|
| 38 |
-
|
| 39 |
-
|
|
|
|
| 40 |
if st.button(f'Select Sample Image {idx + 1}', key=f'sample_{idx}'):
|
| 41 |
self.process_new_image(sample_image_path, image, kbvqa)
|
| 42 |
|
|
@@ -47,7 +48,9 @@ class InferenceRunner(StateManager):
|
|
| 47 |
|
| 48 |
# Display and interact with each uploaded/selected image
|
| 49 |
for image_key, image_data in self.get_images_data().items():
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
if not image_data['analysis_done']:
|
| 52 |
self.col2.text("Cool image, please click 'Analyze Image'..")
|
| 53 |
if self.col2.button('Analyze Image', key=f'analyze_{image_key}'):
|
|
|
|
| 35 |
for idx, sample_image_path in enumerate(self.sample_images):
|
| 36 |
with cols[idx]:
|
| 37 |
image = Image.open(sample_image_path)
|
| 38 |
+
image_for_display = copy.deepcopy(image) # resize just for the display control without changing original image
|
| 39 |
+
image_for_display = self.resize_image(image_for_display, 100, 100)
|
| 40 |
+
st.image(image_for_display)
|
| 41 |
if st.button(f'Select Sample Image {idx + 1}', key=f'sample_{idx}'):
|
| 42 |
self.process_new_image(sample_image_path, image, kbvqa)
|
| 43 |
|
|
|
|
| 48 |
|
| 49 |
# Display and interact with each uploaded/selected image
|
| 50 |
for image_key, image_data in self.get_images_data().items():
|
| 51 |
+
image_for_display = copy.deepcopy(image_data['image']) # resize just for the display control without changing original image
|
| 52 |
+
image_for_display = self.resize_image(image_for_display, 800, 800)
|
| 53 |
+
self.col2.image(image_for_display, caption=f'Uploaded Image: {image_key[-11:]}')
|
| 54 |
if not image_data['analysis_done']:
|
| 55 |
self.col2.text("Cool image, please click 'Analyze Image'..")
|
| 56 |
if self.col2.button('Analyze Image', key=f'analyze_{image_key}'):
|