Remove big center image from detection.
Browse files
    	
        app.py
    CHANGED
    
    | @@ -82,39 +82,11 @@ model = load_model() | |
| 82 |  | 
| 83 | 
             
            # uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
         | 
| 84 |  | 
| 85 | 
            -
            if uploaded_file is not None:
         | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
                st.image(image, caption='Uploaded Image.', use_column_width=True)
         | 
| 90 | 
            -
             | 
| 91 | 
            -
                # if st.button('Detect'):
         | 
| 92 | 
            -
                    # st.write("Processing...")
         | 
| 93 | 
            -
                    # input_image = preprocess_image(image)
         | 
| 94 | 
            -
                    # pred_bbox, pred_label, pred_label_confidence = predict(model, input_image)
         | 
| 95 | 
            -
             | 
| 96 | 
            -
                    # # Updated label mapping based on the dataset
         | 
| 97 | 
            -
                    # label_mapping = {
         | 
| 98 | 
            -
                    #     0: 'Atelectasis',
         | 
| 99 | 
            -
                    #     1: 'Cardiomegaly',
         | 
| 100 | 
            -
                    #     2: 'Effusion',
         | 
| 101 | 
            -
                    #     3: 'Infiltrate',
         | 
| 102 | 
            -
                    #     4: 'Mass',
         | 
| 103 | 
            -
                    #     5: 'Nodule',
         | 
| 104 | 
            -
                    #     6: 'Pneumonia',
         | 
| 105 | 
            -
                    #     7: 'Pneumothorax'
         | 
| 106 | 
            -
                    # }
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                    # if pred_label_confidence < 0.2:
         | 
| 109 | 
            -
                    #     st.write("May not detect a disease.")
         | 
| 110 | 
            -
                    # else:
         | 
| 111 | 
            -
                    #     pred_label_name = label_mapping[pred_label]
         | 
| 112 | 
            -
                    #     st.write(f"Prediction Label: {pred_label_name}")
         | 
| 113 | 
            -
                    #     st.write(f"Prediction Bounding Box: {pred_bbox}")
         | 
| 114 | 
            -
                    #     st.write(f"Prediction Confidence: {pred_label_confidence:.2f}")
         | 
| 115 | 
            -
             | 
| 116 | 
            -
                    #     output_image = draw_bbox(image.copy(), pred_bbox)
         | 
| 117 | 
            -
                    #     st.image(output_image, caption='Detected Image.', use_column_width=True)
         | 
| 118 |  | 
| 119 |  | 
| 120 | 
             
            # Utility Functions
         | 
|  | |
| 82 |  | 
| 83 | 
             
            # uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
         | 
| 84 |  | 
| 85 | 
            +
            # if uploaded_file is not None:
         | 
| 86 | 
            +
            #     file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
         | 
| 87 | 
            +
            #     image = cv2.imdecode(file_bytes, 1)
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                # st.image(image, caption='Uploaded Image.', use_column_width=True)
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 90 |  | 
| 91 |  | 
| 92 | 
             
            # Utility Functions
         | 
