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