FrancescoLR commited on
Commit
527dbff
·
verified ·
1 Parent(s): df77e6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
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
- # Gradio Interfaceinterface = gr.Interface(
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
- # Add Markdown as a separate element
233
  markdown = gr.Markdown("""
234
  **If you find this tool useful, please consider citing:**
235
 
236
- - **Reference 1:** Machine Learning / Network Science
237
- P286 A Deep Learning-Based Pipeline for Longitudinal White Matter Lesion Segmentation Using Diverse FLAIR Images
238
- F. La Rosa, et al.
239
- *ACTRIMS Forum 2023 - Poster Presentations. Multiple Sclerosis Journal.* 2023;29(2_suppl):18-242.
240
- DOI: [10.1177/13524585231169437](https://doi.org/10.1177/13524585231169437)
241
 
242
- - **Reference 2:** A Deep Learning Model for Generalized Use in Medical Imaging
243
- *Nature Methods*, 2020.
244
- DOI: [10.1038/s41592-020-01008-z](https://www.nature.com/articles/s41592-020-01008-z)
 
245
  """)
246
 
247
- # Use a Gradio Blocks layout to include the Markdown
248
  with gr.Blocks() as demo:
249
- interface.render()
250
- markdown.render()
 
 
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
- interface.launch(share=True)
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