Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,25 +5,6 @@ import zipfile
|
|
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:
|
14 |
-
subprocess.run(command, shell=True, check=True)
|
15 |
-
print("Script 'install.sh' has been made executable.")
|
16 |
-
except subprocess.CalledProcessError as e:
|
17 |
-
print(f"Error while making the script executable: {e}")
|
18 |
-
|
19 |
-
command = "./install.sh"
|
20 |
-
|
21 |
-
try:
|
22 |
-
subprocess.run(command, shell=True, check=True)
|
23 |
-
print("Script 'install.sh' has been made executable.")
|
24 |
-
except subprocess.CalledProcessError as e:
|
25 |
-
print(f"Error while making the script executable: {e}")
|
26 |
-
|
27 |
# Streamlit app title
|
28 |
st.title("DICOM Image Viewer")
|
29 |
|
@@ -65,6 +46,11 @@ if uploaded_zip_file is not None:
|
|
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,4 +59,4 @@ if uploaded_zip_file is not None:
|
|
73 |
os.remove(file)
|
74 |
os.rmdir(temp_dir)
|
75 |
|
76 |
-
st.write("Upload a ZIP file containing DICOM slices to view the images.")
|
|
|
5 |
import os
|
6 |
import subprocess
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Streamlit app title
|
9 |
st.title("DICOM Image Viewer")
|
10 |
|
|
|
46 |
plt = display_dicom_image(selected_slice, dicom_files)
|
47 |
st.pyplot(plt)
|
48 |
|
49 |
+
# Run the command
|
50 |
+
command = f"bin/C2C spine -i {temp_dir}"
|
51 |
+
st.write("Running command:", command)
|
52 |
+
subprocess.run(command, shell=True)
|
53 |
+
|
54 |
except Exception as e:
|
55 |
st.error(f"Error: {str(e)}")
|
56 |
finally:
|
|
|
59 |
os.remove(file)
|
60 |
os.rmdir(temp_dir)
|
61 |
|
62 |
+
st.write("Upload a ZIP file containing DICOM slices to view the images and run the command.")
|