AdritRao commited on
Commit
2cbcf15
1 Parent(s): dd63625

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -19
app.py CHANGED
@@ -5,6 +5,9 @@ import zipfile
5
  import os
6
  import subprocess
7
 
 
 
 
8
  command = "chmod +x install.sh"
9
 
10
  try:
@@ -45,9 +48,6 @@ if uploaded_zip_file is not None:
45
  temp_dir = "temp_dicom_dir"
46
  os.makedirs(temp_dir, exist_ok=True)
47
 
48
- full_temp_dir_path = os.path.abspath(temp_dir)
49
- print("Full path to temp_dicom_dir:", full_temp_dir_path)
50
-
51
  with zipfile.ZipFile(uploaded_zip_file, "r") as zip_ref:
52
  zip_ref.extractall(temp_dir)
53
 
@@ -65,21 +65,6 @@ if uploaded_zip_file is not None:
65
  plt = display_dicom_image(selected_slice, dicom_files)
66
  st.pyplot(plt)
67
 
68
- # os.chdir("Comp2Comp-main")
69
-
70
- # command = f"/bin/C2C spine -i {temp_dir}"
71
- # st.write("Running command:", command)
72
-
73
- # progress_bar = st.progress(0) # Initialize the progress bar
74
- # process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
75
-
76
- # for line in process.stdout:
77
- # st.text(line.strip())
78
- # progress = line.strip().split()
79
- # if progress and progress[0].isdigit():
80
- # percent_done = int(progress[0])
81
- # progress_bar.progress(percent_done)
82
-
83
  except Exception as e:
84
  st.error(f"Error: {str(e)}")
85
  finally:
@@ -88,4 +73,4 @@ if uploaded_zip_file is not None:
88
  os.remove(file)
89
  os.rmdir(temp_dir)
90
 
91
- st.write("Upload a ZIP file containing DICOM slices to view the images and run the command.")
 
5
  import os
6
  import subprocess
7
 
8
+ import subprocess
9
+
10
+ # Command to make the script executable
11
  command = "chmod +x install.sh"
12
 
13
  try:
 
48
  temp_dir = "temp_dicom_dir"
49
  os.makedirs(temp_dir, exist_ok=True)
50
 
 
 
 
51
  with zipfile.ZipFile(uploaded_zip_file, "r") as zip_ref:
52
  zip_ref.extractall(temp_dir)
53
 
 
65
  plt = display_dicom_image(selected_slice, dicom_files)
66
  st.pyplot(plt)
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  except Exception as e:
69
  st.error(f"Error: {str(e)}")
70
  finally:
 
73
  os.remove(file)
74
  os.rmdir(temp_dir)
75
 
76
+ st.write("Upload a ZIP file containing DICOM slices to view the images.")