awacke1 commited on
Commit
09a2b2a
·
1 Parent(s): 20a597f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -2,15 +2,18 @@ import streamlit as st
2
  import base64
3
  import time
4
 
5
- # Read the video file as bytes
6
- with open("Walking on Bourbon Street.mp4", "rb") as file:
7
- video_bytes = file.read()
8
-
 
 
 
 
 
9
  video_placeholder = st.empty()
10
-
11
- # Encode the video bytes as base64
12
- video_base64 = base64.b64encode(video_bytes).decode()
13
-
14
  # Create the HTML video element
15
  video_html = f"""
16
  <video autoplay controls>
 
2
  import base64
3
  import time
4
 
5
+ @st.cache_resource
6
+ def Base64CacheIt(filename):
7
+ # Read the video file as bytes
8
+ with open(filename, "rb") as file:
9
+ video_bytes = file.read()
10
+ # Encode the video bytes as base64
11
+ video_base64 = base64.b64encode(video_bytes).decode()
12
+ return video_base64
13
+
14
  video_placeholder = st.empty()
15
+ video_base64 = Base64CacheIt("Walking on Bourbon Street.mp4")
16
+
 
 
17
  # Create the HTML video element
18
  video_html = f"""
19
  <video autoplay controls>