Commit
·
c1779e1
1
Parent(s):
356090c
Update app.py
Browse files
app.py
CHANGED
@@ -119,10 +119,16 @@ def build_interface(iter=3, data_folder=VIDEO_PATH):
|
|
119 |
# some initial values
|
120 |
envs = parse_envs()
|
121 |
env_name = envs[random.randint(0, len(envs)-1)] # random pick an env
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
if FORMAT == 'mp4':
|
127 |
left = gr.PlayableVideo(left_video_path, label="left_video")
|
128 |
right = gr.PlayableVideo(right_video_path, label="right_video")
|
|
|
119 |
# some initial values
|
120 |
envs = parse_envs()
|
121 |
env_name = envs[random.randint(0, len(envs)-1)] # random pick an env
|
122 |
+
# choose video
|
123 |
+
videos = os.listdir(os.path.join(data_folder, env_name))
|
124 |
+
video_files = []
|
125 |
+
for f in videos:
|
126 |
+
if f.endswith(f'.{FORMAT}'):
|
127 |
+
video_files.append(os.path.join(data_folder, env_name, f))
|
128 |
+
# randomly choose two videos
|
129 |
+
selected_video_ids = np.random.choice(len(video_files), 2, replace=False)
|
130 |
+
left_video_path = video_files[selected_video_ids[0]]
|
131 |
+
right_video_path = video_files[selected_video_ids[1]]
|
132 |
if FORMAT == 'mp4':
|
133 |
left = gr.PlayableVideo(left_video_path, label="left_video")
|
134 |
right = gr.PlayableVideo(right_video_path, label="right_video")
|