Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
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>
|
17 |
+
<source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
|
18 |
+
Your browser does not support the video element.
|
19 |
+
</video>
|
20 |
+
"""
|
21 |
+
|
22 |
+
video_placeholder.empty()
|
23 |
+
time.sleep(1)
|
24 |
+
video_placeholder.markdown(video_html, unsafe_allow_html=True)
|