Spaces:
Running
on
Zero
Running
on
Zero
Francesco
commited on
Commit
·
c5b67f9
1
Parent(s):
2fa3177
Updated app.py
Browse files
app.py
CHANGED
|
@@ -71,6 +71,8 @@ def run_nnunet_predict(nifti_file):
|
|
| 71 |
"-tr", "nnUNetTrainer_8000epochs",
|
| 72 |
"-device", "cuda" # Explicitly use GPU
|
| 73 |
]
|
|
|
|
|
|
|
| 74 |
try:
|
| 75 |
subprocess.run(command, check=True)
|
| 76 |
|
|
@@ -86,14 +88,14 @@ def run_nnunet_predict(nifti_file):
|
|
| 86 |
extract_middle_slice(input_path, input_slice_path)
|
| 87 |
extract_middle_slice(new_output_file, output_slice_path)
|
| 88 |
|
|
|
|
| 89 |
return input_slice_path, output_slice_path, new_output_file
|
| 90 |
else:
|
| 91 |
return "Error: Output file not found."
|
| 92 |
except subprocess.CalledProcessError as e:
|
| 93 |
return f"Error: {e}"
|
| 94 |
|
| 95 |
-
# Gradio Interface
|
| 96 |
-
interface = gr.Interface(
|
| 97 |
fn=run_nnunet_predict,
|
| 98 |
inputs=gr.File(label="Upload FLAIR Image (.nii.gz)"),
|
| 99 |
outputs=[
|
|
|
|
| 71 |
"-tr", "nnUNetTrainer_8000epochs",
|
| 72 |
"-device", "cuda" # Explicitly use GPU
|
| 73 |
]
|
| 74 |
+
print("Files in /tmp/output:")
|
| 75 |
+
print(os.listdir(OUTPUT_DIR))
|
| 76 |
try:
|
| 77 |
subprocess.run(command, check=True)
|
| 78 |
|
|
|
|
| 88 |
extract_middle_slice(input_path, input_slice_path)
|
| 89 |
extract_middle_slice(new_output_file, output_slice_path)
|
| 90 |
|
| 91 |
+
# Return paths for the Gradio interface
|
| 92 |
return input_slice_path, output_slice_path, new_output_file
|
| 93 |
else:
|
| 94 |
return "Error: Output file not found."
|
| 95 |
except subprocess.CalledProcessError as e:
|
| 96 |
return f"Error: {e}"
|
| 97 |
|
| 98 |
+
# Gradio Interfaceinterface = gr.Interface(
|
|
|
|
| 99 |
fn=run_nnunet_predict,
|
| 100 |
inputs=gr.File(label="Upload FLAIR Image (.nii.gz)"),
|
| 101 |
outputs=[
|