Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,8 @@ def detect_objects(image_path):
|
|
70 |
img, img0 = preprocess_image(dicom_image)
|
71 |
pred = infer(model, img)
|
72 |
results = postprocess(pred, dicom_image, img)
|
73 |
-
return results, dicom_image
|
|
|
74 |
|
75 |
def draw_bounding_boxes(img, results):
|
76 |
for (x1, y1, x2, y2), conf, cls in results:
|
@@ -81,9 +82,12 @@ def draw_bounding_boxes(img, results):
|
|
81 |
return img
|
82 |
|
83 |
def show_preds_image(filepath):
|
84 |
-
results, img0 = detect_objects(filepath)
|
|
|
85 |
img_with_boxes = draw_bounding_boxes(img0, results)
|
86 |
-
|
|
|
|
|
87 |
|
88 |
def read_and_preprocess_dicom(file_path: str):
|
89 |
"""
|
|
|
70 |
img, img0 = preprocess_image(dicom_image)
|
71 |
pred = infer(model, img)
|
72 |
results = postprocess(pred, dicom_image, img)
|
73 |
+
#return results, dicom_image
|
74 |
+
return results, dicom_image, dicom_meta
|
75 |
|
76 |
def draw_bounding_boxes(img, results):
|
77 |
for (x1, y1, x2, y2), conf, cls in results:
|
|
|
82 |
return img
|
83 |
|
84 |
def show_preds_image(filepath):
|
85 |
+
#results, img0 = detect_objects(filepath)
|
86 |
+
results, img0, dicom_meta = detect_objects(filepath)
|
87 |
img_with_boxes = draw_bounding_boxes(img0, results)
|
88 |
+
|
89 |
+
#return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB)
|
90 |
+
return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB), dicom_meta
|
91 |
|
92 |
def read_and_preprocess_dicom(file_path: str):
|
93 |
"""
|