Update my_model/tabs/run_inference.py
Browse files
    	
        my_model/tabs/run_inference.py
    CHANGED
    
    | @@ -35,7 +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 = self.resize_image(sample_image_path,  | 
| 39 | 
             
                            st.image(image)
         | 
| 40 | 
             
                            if st.button(f'Select Sample Image {idx + 1}', key=f'sample_{idx}'):
         | 
| 41 | 
             
                                self.process_new_image(sample_image_path, image, kbvqa)
         | 
| @@ -71,6 +71,27 @@ class InferenceRunner(StateManager): | |
| 71 |  | 
| 72 | 
             
                def run_inference(self):
         | 
| 73 | 
             
                    self.set_up_widgets()
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 74 | 
             
                    st.session_state['settings_changed'] = self.has_state_changed()
         | 
| 75 | 
             
                    if st.session_state['settings_changed']:
         | 
| 76 | 
             
                        self.col1.warning("Model settings have changed, please reload the model, this will take a second .. ")
         | 
|  | |
| 35 | 
             
                    for idx, sample_image_path in enumerate(self.sample_images):
         | 
| 36 | 
             
                        with cols[idx]:
         | 
| 37 | 
             
                            image = Image.open(sample_image_path)
         | 
| 38 | 
            +
                            image = self.resize_image(sample_image_path, 100, 100)
         | 
| 39 | 
             
                            st.image(image)
         | 
| 40 | 
             
                            if st.button(f'Select Sample Image {idx + 1}', key=f'sample_{idx}'):
         | 
| 41 | 
             
                                self.process_new_image(sample_image_path, image, kbvqa)
         | 
|  | |
| 71 |  | 
| 72 | 
             
                def run_inference(self):
         | 
| 73 | 
             
                    self.set_up_widgets()
         | 
| 74 | 
            +
             | 
| 75 | 
            +
             | 
| 76 | 
            +
             | 
| 77 | 
            +
                    
         | 
| 78 | 
            +
                    self.col1.write("Choose from sample images:")
         | 
| 79 | 
            +
                    cols = self.col1.columns(len(self.sample_images))
         | 
| 80 | 
            +
                    for idx, sample_image_path in enumerate(self.sample_images):
         | 
| 81 | 
            +
                        with cols[idx]:
         | 
| 82 | 
            +
                            image = Image.open(sample_image_path)
         | 
| 83 | 
            +
                            image = self.resize_image(sample_image_path, 100, 100)
         | 
| 84 | 
            +
                            st.image(image)
         | 
| 85 | 
            +
                            if st.button(f'Select Sample Image {idx + 1}', key=f'sample_{idx}'):
         | 
| 86 | 
            +
                                self.process_new_image(sample_image_path, image, kbvqa)
         | 
| 87 | 
            +
             | 
| 88 | 
            +
             | 
| 89 | 
            +
             | 
| 90 | 
            +
             | 
| 91 | 
            +
             | 
| 92 | 
            +
             | 
| 93 | 
            +
             | 
| 94 | 
            +
                    
         | 
| 95 | 
             
                    st.session_state['settings_changed'] = self.has_state_changed()
         | 
| 96 | 
             
                    if st.session_state['settings_changed']:
         | 
| 97 | 
             
                        self.col1.warning("Model settings have changed, please reload the model, this will take a second .. ")
         | 
