Update app.py
Browse files
app.py
CHANGED
@@ -126,6 +126,7 @@ def read_and_preprocess_dicom(file_path: str):
|
|
126 |
|
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")
|
@@ -164,20 +165,21 @@ def build_interface():
|
|
164 |
file_path = gr.File(label="Input DICOM Data")
|
165 |
|
166 |
with gr.Row():
|
167 |
-
dicom_image = gr.Image(type="
|
|
|
168 |
dicom_meta = gr.Dataframe(headers=None, label="Metadata")
|
169 |
|
170 |
inputs = [file_path]
|
171 |
outputs = [dicom_image, dicom_meta]
|
172 |
-
file_path.upload(fn=read_and_preprocess_dicom, inputs=inputs, outputs=outputs)
|
173 |
|
174 |
clear_button = gr.ClearButton(components=inputs + outputs, )
|
175 |
|
176 |
example = gr.Examples(
|
177 |
['samples/81_80.dcm','samples/110_109.dcm','samples/189_188.dcm'],
|
178 |
inputs=inputs,
|
179 |
-
|
180 |
-
outputs=dicom_image,
|
181 |
#fn=read_and_preprocess_dicom,
|
182 |
fn=show_preds_image,
|
183 |
cache_examples=True
|
@@ -189,4 +191,4 @@ def build_interface():
|
|
189 |
if __name__ == '__main__':
|
190 |
demo = build_interface()
|
191 |
demo.launch
|
192 |
-
|
|
|
126 |
|
127 |
return image, df_metadata.to_pandas() # Convert to pandas DataFrame for Gradio compatibility
|
128 |
|
129 |
+
'''
|
130 |
# Define Gradio components
|
131 |
input_component = gr.File(label="Input DICOM Data")
|
132 |
output_component = gr.components.Image(type="numpy", label="Output Image")
|
|
|
165 |
file_path = gr.File(label="Input DICOM Data")
|
166 |
|
167 |
with gr.Row():
|
168 |
+
dicom_image = gr.Image(type="numpy", label="Output Image")
|
169 |
+
#dicom_image = gr.Image(type="pil", label="DICOM Image")
|
170 |
dicom_meta = gr.Dataframe(headers=None, label="Metadata")
|
171 |
|
172 |
inputs = [file_path]
|
173 |
outputs = [dicom_image, dicom_meta]
|
174 |
+
#file_path.upload(fn=read_and_preprocess_dicom, inputs=inputs, outputs=outputs)
|
175 |
|
176 |
clear_button = gr.ClearButton(components=inputs + outputs, )
|
177 |
|
178 |
example = gr.Examples(
|
179 |
['samples/81_80.dcm','samples/110_109.dcm','samples/189_188.dcm'],
|
180 |
inputs=inputs,
|
181 |
+
outputs=outputs,
|
182 |
+
#outputs=dicom_image,
|
183 |
#fn=read_and_preprocess_dicom,
|
184 |
fn=show_preds_image,
|
185 |
cache_examples=True
|
|
|
191 |
if __name__ == '__main__':
|
192 |
demo = build_interface()
|
193 |
demo.launch
|
194 |
+
|