FrancescoLR commited on
Commit
812aa8d
·
1 Parent(s): 8e1ad0c

Updated app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -71,13 +71,12 @@ interface = gr.Interface(
71
  description="Upload a skull-stripped FLAIR image (.nii.gz) to generate a binary segmentation of MS lesions."
72
  )
73
 
74
- # Force GPU initialization
75
  if torch.cuda.is_available():
76
- print("CUDA is available. Initializing GPU...")
77
- device = torch.device("cuda:0")
78
- torch.tensor([1.0]).to(device) # Trigger GPU initialization
79
  else:
80
  print("No GPU available. Falling back to CPU.")
 
81
 
82
  # Download model files before launching the app
83
  download_model()
 
71
  description="Upload a skull-stripped FLAIR image (.nii.gz) to generate a binary segmentation of MS lesions."
72
  )
73
 
74
+ # Debugging GPU environment
75
  if torch.cuda.is_available():
76
+ print(f"GPU is available: {torch.cuda.get_device_name(0)}")
 
 
77
  else:
78
  print("No GPU available. Falling back to CPU.")
79
+ os.system("nvidia-smi") # Check if NVIDIA tools are available
80
 
81
  # Download model files before launching the app
82
  download_model()