Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -105,25 +105,28 @@ if uploaded_zip_file is not None:
|
|
105 |
# Construct the paths to the video and image files inside the first subdirectory
|
106 |
video_path = os.path.join(outputs_directory, first_subdirectory, "temp_dicom_dir/images/summary/aaa.mp4")
|
107 |
image_path = os.path.join(outputs_directory, first_subdirectory, "temp_dicom_dir/images/summary/diameter_graph.png")
|
|
|
108 |
|
|
|
|
|
|
|
|
|
109 |
# Display the video generated by the inference script
|
110 |
if os.path.exists(video_path):
|
|
|
111 |
st.video(video_path, format="video/mp4")
|
112 |
|
113 |
# Display the image generated by the inference script
|
114 |
if os.path.exists(image_path):
|
115 |
-
st.
|
|
|
116 |
else:
|
117 |
st.warning("No subdirectories or folders found inside the 'outputs' directory.")
|
118 |
|
119 |
|
120 |
|
|
|
121 |
except Exception as e:
|
122 |
st.error(f"Error: {str(e)}")
|
123 |
-
finally:
|
124 |
-
# Clean up by removing the temporary directory
|
125 |
-
for file in dicom_files:
|
126 |
-
os.remove(file)
|
127 |
-
os.rmdir(temp_dir)
|
128 |
|
129 |
st.write("Upload a ZIP file containing DICOM slices to view the images.")
|
|
|
105 |
# Construct the paths to the video and image files inside the first subdirectory
|
106 |
video_path = os.path.join(outputs_directory, first_subdirectory, "temp_dicom_dir/images/summary/aaa.mp4")
|
107 |
image_path = os.path.join(outputs_directory, first_subdirectory, "temp_dicom_dir/images/summary/diameter_graph.png")
|
108 |
+
largest_slice = os.path.join(outputs_directory, first_subdirectory, "temp_dicom_dir/images/summary/out.png")
|
109 |
|
110 |
+
if os.path.exists(largest_slice):
|
111 |
+
st.title("Largest Slice")
|
112 |
+
st.image(largest_slice, use_column_width=True)
|
113 |
+
|
114 |
# Display the video generated by the inference script
|
115 |
if os.path.exists(video_path):
|
116 |
+
st.title("Video")
|
117 |
st.video(video_path, format="video/mp4")
|
118 |
|
119 |
# Display the image generated by the inference script
|
120 |
if os.path.exists(image_path):
|
121 |
+
st.title("Diameter Graph")
|
122 |
+
st.image(image_path, use_column_width=True)
|
123 |
else:
|
124 |
st.warning("No subdirectories or folders found inside the 'outputs' directory.")
|
125 |
|
126 |
|
127 |
|
128 |
+
|
129 |
except Exception as e:
|
130 |
st.error(f"Error: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
st.write("Upload a ZIP file containing DICOM slices to view the images.")
|