Spaces:
Running
on
Zero
Running
on
Zero
Francesco
commited on
Commit
·
812aa8d
1
Parent(s):
8e1ad0c
Updated app.py
Browse files
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 |
-
#
|
| 75 |
if torch.cuda.is_available():
|
| 76 |
-
print("
|
| 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()
|