my
Browse files
    	
        app.py
    CHANGED
    
    | @@ -136,7 +136,7 @@ def process_image(): | |
| 136 | 
             
                            f.write(f"Object {i + 1}: Class {class_id}, Confidence: {confidence:.2f}, "
         | 
| 137 | 
             
                                    f"Bounding box: ({x1}, {y1}, {x2}, {y2})\n")
         | 
| 138 | 
             
                            cropped_image = random_image_data1[y1:y2, x1:x2]
         | 
| 139 | 
            -
                            cropped_image_path = os.path.join( | 
| 140 | 
             
                            cv2.imwrite(cropped_image_path, cropped_image)
         | 
| 141 | 
             
                            print(f"Enhanced cropped image saved at {cropped_image_path}")
         | 
| 142 | 
             
                    print(f"Checking contents of /app/data: {bounding_box_save_path}")
         | 
| @@ -230,11 +230,11 @@ def process_image(): | |
| 230 |  | 
| 231 | 
             
            @app.route('/download_csv/<filename>')
         | 
| 232 | 
             
            def download_csv(filename):
         | 
| 233 | 
            -
                return send_from_directory( | 
| 234 |  | 
| 235 | 
             
            @app.route('/download_image/<filename>')
         | 
| 236 | 
             
            def download_image(filename):
         | 
| 237 | 
            -
                return send_from_directory( | 
| 238 |  | 
| 239 |  | 
| 240 |  | 
|  | |
| 136 | 
             
                            f.write(f"Object {i + 1}: Class {class_id}, Confidence: {confidence:.2f}, "
         | 
| 137 | 
             
                                    f"Bounding box: ({x1}, {y1}, {x2}, {y2})\n")
         | 
| 138 | 
             
                            cropped_image = random_image_data1[y1:y2, x1:x2]
         | 
| 139 | 
            +
                            cropped_image_path = os.path.join('./app/cropped_images/', f"cropped_object_{i + 1}.jpg")
         | 
| 140 | 
             
                            cv2.imwrite(cropped_image_path, cropped_image)
         | 
| 141 | 
             
                            print(f"Enhanced cropped image saved at {cropped_image_path}")
         | 
| 142 | 
             
                    print(f"Checking contents of /app/data: {bounding_box_save_path}")
         | 
|  | |
| 230 |  | 
| 231 | 
             
            @app.route('/download_csv/<filename>')
         | 
| 232 | 
             
            def download_csv(filename):
         | 
| 233 | 
            +
                return send_from_directory('./app/Folder2', filename, as_attachment=True)
         | 
| 234 |  | 
| 235 | 
             
            @app.route('/download_image/<filename>')
         | 
| 236 | 
             
            def download_image(filename):
         | 
| 237 | 
            +
                return send_from_directory('./app/Folder3', filename, as_attachment=True)
         | 
| 238 |  | 
| 239 |  | 
| 240 |  |