Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
c1f2c57
1
Parent(s):
e388d15
Updated app.py
Browse files
app.py
CHANGED
@@ -31,12 +31,14 @@ def run_nnunet_predict(nifti_file):
|
|
31 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
32 |
|
33 |
# Save the uploaded file to the input directory
|
34 |
-
input_path = os.path.join(INPUT_DIR, "
|
35 |
with open(input_path, "wb") as f:
|
36 |
-
f.write(nifti_file.read())
|
37 |
|
38 |
# Set environment variables for nnUNet
|
39 |
-
os.environ["
|
|
|
|
|
40 |
|
41 |
# Construct and run the nnUNetv2_predict command
|
42 |
command = [
|
|
|
31 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
32 |
|
33 |
# Save the uploaded file to the input directory
|
34 |
+
input_path = os.path.join(INPUT_DIR, "image.nii.gz")
|
35 |
with open(input_path, "wb") as f:
|
36 |
+
f.write(nifti_file.file.read()) # Use .file to access the underlying file object
|
37 |
|
38 |
# Set environment variables for nnUNet
|
39 |
+
os.environ["nnUNet_raw"] = DATASET_DIR
|
40 |
+
os.environ["nnUNet_preprocessed"] = DATASET_DIR
|
41 |
+
os.environ["nnUNet_results"] = DATASET_DIR
|
42 |
|
43 |
# Construct and run the nnUNetv2_predict command
|
44 |
command = [
|