wangjin2000 commited on
Commit
227aa8a
·
verified ·
1 Parent(s): 5ca5f28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -20
app.py CHANGED
@@ -96,26 +96,6 @@ def show_preds_image(filepath):
96
  #img0 = cv2.imread(filepath)
97
  img_with_boxes = draw_bounding_boxes(img0, results)
98
  return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB)
99
-
100
-
101
- # Define Gradio components
102
- #input_component = gr.components.Image(type="filepath", label="Input Image")
103
- #input_component = gr.components.Image(type="pil", label="Input Image")
104
- input_component = gr.File(label="Input DICOM Data")
105
- output_component = gr.components.Image(type="numpy", label="Output Image")
106
-
107
- # Create Gradio interface
108
- interface = gr.Interface(
109
- fn=show_preds_image,
110
- inputs=input_component,
111
- outputs=output_component,
112
- title="Lung Nodule Detection",
113
- examples=['samples/81_80.dcm','samples/110_109.dcm','samples/189_188.dcm'],
114
- description=' "This online deployment proves the effectiveness and efficient function of the machine learning model in identifying lung cancer nodules. The implementation of YOLO for core detection tasks is employed that is an efficient and accurate algorithm for object detection. Through the precise hyper-parameter tuning process, the model proposed in this paper has given an impressive boost in the performance. Moreover, the model uses Retinanet algorithm which is recognized as the powerful tool effective in dense object detection. In an attempt to enhance the model’s performance, the backbone of this architecture consists of a Feature Pyramid Network (FPN). The FPN plays an important role in boosting the model’s capacity in recognizing objects in different scales through the construction of high semantic feature map in different resolutions. In conclusion, this deployment encompasses YOLOv5, hyperparameter optimization, Retinanet, and FPN as one of the most effective and modern solutions for the detection of lung cancer nodules." ~ Basil Shaji 😇',
115
- live=False,
116
- )
117
-
118
- interface.launch()
119
 
120
  def read_and_preprocess_dicom(file_path: str):
121
  """
@@ -159,6 +139,25 @@ def read_and_preprocess_dicom(file_path: str):
159
 
160
  return image, df_metadata.to_pandas() # Convert to pandas DataFrame for Gradio compatibility
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  '''
163
  def build_interface():
164
  """
 
96
  #img0 = cv2.imread(filepath)
97
  img_with_boxes = draw_bounding_boxes(img0, results)
98
  return cv2.cvtColor(img_with_boxes, cv2.COLOR_BGR2RGB)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
  def read_and_preprocess_dicom(file_path: str):
101
  """
 
139
 
140
  return image, df_metadata.to_pandas() # Convert to pandas DataFrame for Gradio compatibility
141
 
142
+ # Define Gradio components
143
+ #input_component = gr.components.Image(type="filepath", label="Input Image")
144
+ #input_component = gr.components.Image(type="pil", label="Input Image")
145
+ input_component = gr.File(label="Input DICOM Data")
146
+ output_component = gr.components.Image(type="numpy", label="Output Image")
147
+
148
+ # Create Gradio interface
149
+ interface = gr.Interface(
150
+ fn=show_preds_image,
151
+ inputs=input_component,
152
+ outputs=output_component,
153
+ title="Lung Nodule Detection",
154
+ examples=['samples/81_80.dcm','samples/110_109.dcm','samples/189_188.dcm'],
155
+ description=' "This online deployment proves the effectiveness and efficient function of the machine learning model in identifying lung cancer nodules. The implementation of YOLO for core detection tasks is employed that is an efficient and accurate algorithm for object detection. Through the precise hyper-parameter tuning process, the model proposed in this paper has given an impressive boost in the performance. Moreover, the model uses Retinanet algorithm which is recognized as the powerful tool effective in dense object detection. In an attempt to enhance the model’s performance, the backbone of this architecture consists of a Feature Pyramid Network (FPN). The FPN plays an important role in boosting the model’s capacity in recognizing objects in different scales through the construction of high semantic feature map in different resolutions. In conclusion, this deployment encompasses YOLOv5, hyperparameter optimization, Retinanet, and FPN as one of the most effective and modern solutions for the detection of lung cancer nodules." ~ Basil Shaji 😇',
156
+ live=False,
157
+ )
158
+
159
+ interface.launch()
160
+
161
  '''
162
  def build_interface():
163
  """