awacke1's picture
Create app.py
1236b34
raw
history blame
No virus
1.06 kB
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()