AdritRao commited on
Commit
d138970
·
1 Parent(s): 4b6fb19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -95,22 +95,19 @@ if uploaded_zip_file is not None:
95
  outputs_directory = "/home/user/app/C2C/comp2comp/outputs"
96
 
97
  # Get a list of subdirectories inside the 'outputs' directory
98
- subdirectories = [subdir for subdir in os.listdir(outputs_directory) if os.path.isdir(os.path.join(outputs_directory, subdir)]
 
99
 
100
- if not subdirectories:
101
- # If there are no subdirectories, use the only folder inside the 'outputs' directory
102
- subdirectories = [d for d in os.listdir(outputs_directory) if os.path.isdir(os.path.join(outputs_directory, d))]
103
-
104
- if subdirectories:
105
- # Get the first (or only) subdirectory
106
- first_subdirectory = subdirectories[0]
107
 
 
108
  # Construct the paths to the video and image files inside the first subdirectory
109
  video_path = os.path.join(outputs_directory, first_subdirectory, "temp_dicom_dir/images/summary/aaa.mp4")
110
  image_path = os.path.join(outputs_directory, first_subdirectory, "temp_dicom_dir/images/summary/diameter_graph.png")
111
 
112
  # Display the video generated by the inference script
113
- if os.path.exists(video_path):
114
  st.video(video_path, format="video/mp4")
115
 
116
  # Display the image generated by the inference script
@@ -120,6 +117,7 @@ if uploaded_zip_file is not None:
120
  st.warning("No subdirectories or folders found inside the 'outputs' directory.")
121
 
122
 
 
123
  except Exception as e:
124
  st.error(f"Error: {str(e)}")
125
  finally:
 
95
  outputs_directory = "/home/user/app/C2C/comp2comp/outputs"
96
 
97
  # Get a list of subdirectories inside the 'outputs' directory
98
+ subdirectories = [subdir for subdir in os.listdir(outputs_directory)
99
+ if os.path.isdir(os.path.join(outputs_directory, subdir)]
100
 
101
+ # Use the first (or only) subdirectory, or None if there are no subdirectories
102
+ first_subdirectory = subdirectories[0] if subdirectories else None
 
 
 
 
 
103
 
104
+ if first_subdirectory:
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
 
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: