Update app.py
Browse files
app.py
CHANGED
@@ -2,15 +2,18 @@ import streamlit as st
|
|
2 |
import base64
|
3 |
import time
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
video_placeholder = st.empty()
|
10 |
-
|
11 |
-
|
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>
|