Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -229,6 +229,7 @@ interface = gr.Interface(
|
|
229 |
description="Upload a skull-stripped FLAIR image (.nii.gz) to generate a binary segmentation of multiple sclerosis lesions.",
|
230 |
)
|
231 |
|
|
|
232 |
# Markdown for citations
|
233 |
markdown = gr.Markdown("""
|
234 |
**If you find this tool useful, please consider citing:**
|
@@ -244,12 +245,26 @@ markdown = gr.Markdown("""
|
|
244 |
DOI: [10.1038/s41592-020-01008-z](https://www.nature.com/articles/s41592-020-01008-z)
|
245 |
""")
|
246 |
|
247 |
-
# Use Gradio Blocks for layout
|
248 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
with gr.Row():
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
# Debugging GPU environment
|
255 |
if torch.cuda.is_available():
|
@@ -258,7 +273,8 @@ else:
|
|
258 |
print("No GPU available. Falling back to CPU.")
|
259 |
os.system("nvidia-smi") # Check if NVIDIA tools are available
|
260 |
|
261 |
-
#
|
262 |
-
|
263 |
-
|
264 |
|
|
|
|
229 |
description="Upload a skull-stripped FLAIR image (.nii.gz) to generate a binary segmentation of multiple sclerosis lesions.",
|
230 |
)
|
231 |
|
232 |
+
# Markdown for citations
|
233 |
# Markdown for citations
|
234 |
markdown = gr.Markdown("""
|
235 |
**If you find this tool useful, please consider citing:**
|
|
|
245 |
DOI: [10.1038/s41592-020-01008-z](https://www.nature.com/articles/s41592-020-01008-z)
|
246 |
""")
|
247 |
|
248 |
+
# Use Gradio Blocks for a clean layout
|
249 |
with gr.Blocks() as demo:
|
250 |
+
# Title and Description
|
251 |
+
gr.Markdown("""
|
252 |
+
# FLAMeS: Multiple Sclerosis Lesion Segmentation
|
253 |
+
|
254 |
+
Upload a skull-stripped FLAIR image (.nii.gz) to generate a binary segmentation of multiple sclerosis lesions.
|
255 |
+
""")
|
256 |
+
|
257 |
+
# Layout for Inputs and Outputs
|
258 |
with gr.Row():
|
259 |
+
with gr.Column(scale=1): # Input column
|
260 |
+
flair_input = gr.File(label="Upload FLAIR Image (.nii.gz)")
|
261 |
+
with gr.Column(scale=2): # Output column
|
262 |
+
seg_output = gr.File(label="Download Segmentation Mask")
|
263 |
+
input_img = gr.Image(label="Input: FLAIR image")
|
264 |
+
output_img = gr.Image(label="Output: Lesion Mask")
|
265 |
+
|
266 |
+
# References
|
267 |
+
gr.Markdown(markdown)
|
268 |
|
269 |
# Debugging GPU environment
|
270 |
if torch.cuda.is_available():
|
|
|
273 |
print("No GPU available. Falling back to CPU.")
|
274 |
os.system("nvidia-smi") # Check if NVIDIA tools are available
|
275 |
|
276 |
+
# Define interface and integrate with Blocks
|
277 |
+
def predict_wrapper(file):
|
278 |
+
return run_nnunet_predict(file)
|
279 |
|
280 |
+
demo.launch(share=True)
|