Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,6 @@ subprocess_executed = False
|
|
15 |
|
16 |
logo_image_path = '1.png'
|
17 |
|
18 |
-
|
19 |
st.image(logo_image_path, width=150)
|
20 |
st.title("Automated Abdominal Aortic Aneurysm Detection")
|
21 |
|
@@ -49,6 +48,13 @@ def zip_and_download(directory, zip_filename):
|
|
49 |
bytes_data = f.read()
|
50 |
st.download_button(label="Download Outputs", data=bytes_data, file_name=zip_filename, mime="application/zip")
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
# Main Streamlit code
|
53 |
def main():
|
54 |
st.write("Upload a ZIP file containing DICOM slices")
|
@@ -82,11 +88,15 @@ def main():
|
|
82 |
subdirectory_path = os.path.join(outputs_directory, first_subdirectory)
|
83 |
temp_dicom_dir_path = os.path.join(subdirectory_path, "temp_dicom_dir")
|
84 |
|
85 |
-
video_path =
|
86 |
-
image_path =
|
87 |
-
largest_slice =
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
if
|
90 |
zip_filename = os.path.join(temp_dir, "outputs.zip")
|
91 |
zip_and_download(temp_dicom_dir_path, zip_filename)
|
92 |
|
|
|
15 |
|
16 |
logo_image_path = '1.png'
|
17 |
|
|
|
18 |
st.image(logo_image_path, width=150)
|
19 |
st.title("Automated Abdominal Aortic Aneurysm Detection")
|
20 |
|
|
|
48 |
bytes_data = f.read()
|
49 |
st.download_button(label="Download Outputs", data=bytes_data, file_name=zip_filename, mime="application/zip")
|
50 |
|
51 |
+
# Function to search for files in all subdirectories
|
52 |
+
def search_file(start_path, target_file):
|
53 |
+
for root, _, files in os.walk(start_path):
|
54 |
+
if target_file in files:
|
55 |
+
return os.path.join(root, target_file)
|
56 |
+
return None
|
57 |
+
|
58 |
# Main Streamlit code
|
59 |
def main():
|
60 |
st.write("Upload a ZIP file containing DICOM slices")
|
|
|
88 |
subdirectory_path = os.path.join(outputs_directory, first_subdirectory)
|
89 |
temp_dicom_dir_path = os.path.join(subdirectory_path, "temp_dicom_dir")
|
90 |
|
91 |
+
video_path = search_file(temp_dicom_dir_path, "aaa.mp4")
|
92 |
+
image_path = search_file(temp_dicom_dir_path, "diameter_graph.png")
|
93 |
+
largest_slice = search_file(temp_dicom_dir_path, "out.png")
|
94 |
+
|
95 |
+
st.write(f"Video Path: {video_path}")
|
96 |
+
st.write(f"Image Path: {image_path}")
|
97 |
+
st.write(f"Largest Slice Path: {largest_slice}")
|
98 |
|
99 |
+
if video_path and image_path and largest_slice:
|
100 |
zip_filename = os.path.join(temp_dir, "outputs.zip")
|
101 |
zip_and_download(temp_dicom_dir_path, zip_filename)
|
102 |
|