awacke1 commited on
Commit
1236b34
1 Parent(s): 974b64e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ import random
4
+
5
+ def get_videos(directory):
6
+ return [f for f in os.listdir(directory) if f.endswith('.mp4')]
7
+
8
+ def main():
9
+ st.title('AIUIUX Video HUDs and-Animations')
10
+
11
+ directory = './videos' # Replace with your directory of videos
12
+ video_files = get_videos(directory)
13
+
14
+ num_rows = len(video_files) // 3
15
+ if len(video_files) % 3:
16
+ num_rows += 1
17
+
18
+ cols = [st.columns(3) for _ in range(num_rows)]
19
+
20
+ for i in range(num_rows):
21
+ for j in range(3):
22
+ idx = i*3 + j
23
+ if idx < len(video_files):
24
+ #showAnimatedGif(os.path.join(directory, gif_files[idx]))
25
+ cols[i][j].video(os.path.join(directory, video_files[idx]))
26
+
27
+ if st.button('Randomize'):
28
+ random.shuffle(video_files)
29
+ for i in range(num_rows):
30
+ for j in range(3):
31
+ idx = i*3 + j
32
+ if idx < len(video_files):
33
+ cols[i][j].video(os.path.join(directory, video_files[idx]))
34
+
35
+ if __name__ == "__main__":
36
+ main()