Update my_model/tabs/run_inference.py
Browse files
    	
        my_model/tabs/run_inference.py
    CHANGED
    
    | @@ -35,8 +35,7 @@ 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 | 
            -
                            image_for_display =  | 
| 39 | 
            -
                            image_for_display = self.resize_image(image_for_display, 300, 300)
         | 
| 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)
         | 
| @@ -48,11 +47,10 @@ class InferenceRunner(StateManager): | |
| 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 =  | 
| 52 | 
            -
                        image_for_display = self.resize_image(image_for_display, 500, 500)
         | 
| 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(" | 
| 56 | 
             
                            if self.col2.button('Analyze Image', key=f'analyze_{image_key}'):
         | 
| 57 | 
             
                                caption, detected_objects_str, image_with_boxes = self.analyze_image(image_data['image'], kbvqa)
         | 
| 58 | 
             
                                self.update_image_data(image_key, caption, detected_objects_str, True)
         | 
|  | |
| 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 = self.resize_image_aspect_ratio(image_for_display, 100)
         | 
|  | |
| 39 | 
             
                            st.image(image_for_display)
         | 
| 40 | 
             
                            if st.button(f'Select Sample Image {idx + 1}', key=f'sample_{idx}'):
         | 
| 41 | 
             
                                self.process_new_image(sample_image_path, image, kbvqa)
         | 
|  | |
| 47 |  | 
| 48 | 
             
                    # Display and interact with each uploaded/selected image
         | 
| 49 | 
             
                    for image_key, image_data in self.get_images_data().items():
         | 
| 50 | 
            +
                        image_for_display = self.resize_image_aspect_ratio(image_for_display, 400)
         | 
|  | |
| 51 | 
             
                        self.col2.image(image_for_display, caption=f'Uploaded Image: {image_key[-11:]}')
         | 
| 52 | 
             
                        if not image_data['analysis_done']:
         | 
| 53 | 
            +
                            self.col2.text("Please click 'Analyze Image'..")
         | 
| 54 | 
             
                            if self.col2.button('Analyze Image', key=f'analyze_{image_key}'):
         | 
| 55 | 
             
                                caption, detected_objects_str, image_with_boxes = self.analyze_image(image_data['image'], kbvqa)
         | 
| 56 | 
             
                                self.update_image_data(image_key, caption, detected_objects_str, True)
         | 
