Update app.py
Browse files
app.py
CHANGED
|
@@ -82,8 +82,6 @@ def draw_bounding_boxes(img, results):
|
|
| 82 |
|
| 83 |
def show_preds_image(filepath):
|
| 84 |
results, img0 = detect_objects(filepath)
|
| 85 |
-
print("in show preds:",results)
|
| 86 |
-
#results = detect_objects(filepath)
|
| 87 |
img_with_boxes = draw_bounding_boxes(img0, results)
|
| 88 |
return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB)
|
| 89 |
|
|
@@ -114,7 +112,6 @@ def read_and_preprocess_dicom(file_path: str):
|
|
| 114 |
image = image_pil.convert('RGB')
|
| 115 |
|
| 116 |
print("In preprocess dicom:", image.size)
|
| 117 |
-
#image = np.array(numpydata)[::-1].copy()
|
| 118 |
image = np.array(image)[:,:,::-1].copy()
|
| 119 |
|
| 120 |
# shape
|
|
@@ -130,8 +127,6 @@ def read_and_preprocess_dicom(file_path: str):
|
|
| 130 |
return image, df_metadata.to_pandas() # Convert to pandas DataFrame for Gradio compatibility
|
| 131 |
|
| 132 |
# Define Gradio components
|
| 133 |
-
#input_component = gr.components.Image(type="filepath", label="Input Image")
|
| 134 |
-
#input_component = gr.components.Image(type="pil", label="Input Image")
|
| 135 |
input_component = gr.File(label="Input DICOM Data")
|
| 136 |
output_component = gr.components.Image(type="numpy", label="Output Image")
|
| 137 |
|
|
@@ -142,7 +137,7 @@ interface = gr.Interface(
|
|
| 142 |
outputs=output_component,
|
| 143 |
title="Lung Nodule Detection",
|
| 144 |
examples=['samples/81_80.dcm','samples/110_109.dcm','samples/189_188.dcm'],
|
| 145 |
-
description=
|
| 146 |
live=False,
|
| 147 |
)
|
| 148 |
|
|
|
|
| 82 |
|
| 83 |
def show_preds_image(filepath):
|
| 84 |
results, img0 = detect_objects(filepath)
|
|
|
|
|
|
|
| 85 |
img_with_boxes = draw_bounding_boxes(img0, results)
|
| 86 |
return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB)
|
| 87 |
|
|
|
|
| 112 |
image = image_pil.convert('RGB')
|
| 113 |
|
| 114 |
print("In preprocess dicom:", image.size)
|
|
|
|
| 115 |
image = np.array(image)[:,:,::-1].copy()
|
| 116 |
|
| 117 |
# shape
|
|
|
|
| 127 |
return image, df_metadata.to_pandas() # Convert to pandas DataFrame for Gradio compatibility
|
| 128 |
|
| 129 |
# Define Gradio components
|
|
|
|
|
|
|
| 130 |
input_component = gr.File(label="Input DICOM Data")
|
| 131 |
output_component = gr.components.Image(type="numpy", label="Output Image")
|
| 132 |
|
|
|
|
| 137 |
outputs=output_component,
|
| 138 |
title="Lung Nodule Detection",
|
| 139 |
examples=['samples/81_80.dcm','samples/110_109.dcm','samples/189_188.dcm'],
|
| 140 |
+
description= "This online deployment proves the effectiveness and efficient function of the machine learning model in identifying lung cancer nodules.",
|
| 141 |
live=False,
|
| 142 |
)
|
| 143 |
|