FrancescoLR commited on
Commit
f01441d
·
1 Parent(s): 2cac7f2

Updated app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -2,8 +2,8 @@ import gradio as gr
2
  import subprocess
3
  import os
4
  import shutil
 
5
 
6
- export nnUNet_results="./model"
7
 
8
  # Define paths
9
  MODEL_DIR = "./model" # Local directory to store the downloaded model
@@ -32,14 +32,12 @@ def run_nnunet_predict(nifti_file):
32
  os.makedirs(OUTPUT_DIR, exist_ok=True)
33
 
34
  # Save the uploaded file to the input directory
35
- input_path = os.path.join(INPUT_DIR, "image.nii.gz")
36
  with open(input_path, "wb") as f:
37
  f.write(nifti_file.read())
38
 
39
  # Set environment variables for nnUNet
40
- os.environ["nnUNet_raw"] = DATASET_DIR
41
- os.environ["nnUNet_preprocessed"] = DATASET_DIR
42
- os.environ["nnUNet_results"] = DATASET_DIR
43
 
44
  # Construct and run the nnUNetv2_predict command
45
  command = [
 
2
  import subprocess
3
  import os
4
  import shutil
5
+ import os
6
 
 
7
 
8
  # Define paths
9
  MODEL_DIR = "./model" # Local directory to store the downloaded model
 
32
  os.makedirs(OUTPUT_DIR, exist_ok=True)
33
 
34
  # Save the uploaded file to the input directory
35
+ input_path = os.path.join(INPUT_DIR, "image_0000.nii.gz")
36
  with open(input_path, "wb") as f:
37
  f.write(nifti_file.read())
38
 
39
  # Set environment variables for nnUNet
40
+ os.environ["nnUNet_results"] = MODEL_DIR
 
 
41
 
42
  # Construct and run the nnUNetv2_predict command
43
  command = [