Spaces:
Running
on
Zero
Running
on
Zero
FrancescoLR
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -214,7 +214,7 @@ def run_nnunet_predict(nifti_file):
|
|
214 |
except subprocess.CalledProcessError as e:
|
215 |
return f"Error: {e}"
|
216 |
|
217 |
-
#
|
218 |
interface = gr.Interface(
|
219 |
fn=run_nnunet_predict,
|
220 |
inputs=[
|
@@ -229,25 +229,27 @@ 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 |
-
#
|
233 |
markdown = gr.Markdown("""
|
234 |
**If you find this tool useful, please consider citing:**
|
235 |
|
236 |
-
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
DOI: [10.1177/13524585231169437](https://doi.org/10.1177/13524585231169437)
|
241 |
|
242 |
-
-
|
243 |
-
|
244 |
-
|
|
|
245 |
""")
|
246 |
|
247 |
-
# Use
|
248 |
with gr.Blocks() as demo:
|
249 |
-
|
250 |
-
|
|
|
|
|
251 |
|
252 |
# Debugging GPU environment
|
253 |
if torch.cuda.is_available():
|
@@ -256,10 +258,7 @@ else:
|
|
256 |
print("No GPU available. Falling back to CPU.")
|
257 |
os.system("nvidia-smi") # Check if NVIDIA tools are available
|
258 |
|
259 |
-
# Download model files before launching the app
|
260 |
-
download_model()
|
261 |
-
|
262 |
# Launch the app
|
263 |
if __name__ == "__main__":
|
264 |
-
|
265 |
|
|
|
214 |
except subprocess.CalledProcessError as e:
|
215 |
return f"Error: {e}"
|
216 |
|
217 |
+
# Define the interface
|
218 |
interface = gr.Interface(
|
219 |
fn=run_nnunet_predict,
|
220 |
inputs=[
|
|
|
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:**
|
235 |
|
236 |
+
1. A Deep Learning-Based Pipeline for Longitudinal White Matter Lesion Segmentation Using Diverse FLAIR Images
|
237 |
+
F. La Rosa, J. Dos Santos Silva, W. A. Mullins, H. Greenspan, J. F. Sumowski, D. S. Reich, & E. S. Beck.
|
238 |
+
*ACTRIMS Forum 2023 - Poster Presentations. Multiple Sclerosis Journal.* 2023;29(2_suppl):18-242.
|
239 |
+
DOI: [10.1177/13524585231169437](https://doi.org/10.1177/13524585231169437)
|
|
|
240 |
|
241 |
+
2. nnU-Net: A Self-Configuring Method for Deep Learning-Based Biomedical Image Segmentation
|
242 |
+
F. Isensee, P. F. Jaeger, S. A. Kohl, J. Petersen, & K. H. Maier-Hein.
|
243 |
+
*Nature Methods.* 2021;18(2):203-211.
|
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 |
+
interface.render()
|
251 |
+
with gr.Row():
|
252 |
+
markdown.render()
|
253 |
|
254 |
# Debugging GPU environment
|
255 |
if torch.cuda.is_available():
|
|
|
258 |
print("No GPU available. Falling back to CPU.")
|
259 |
os.system("nvidia-smi") # Check if NVIDIA tools are available
|
260 |
|
|
|
|
|
|
|
261 |
# Launch the app
|
262 |
if __name__ == "__main__":
|
263 |
+
demo.launch(share=True)
|
264 |
|