Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,25 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
from matplotlib.patches import Polygon, Circle
|
6 |
-
|
7 |
-
def set_background(video_path):
|
8 |
-
"""Sets the background of the Streamlit app to a video."""
|
9 |
-
with open(video_path, "rb") as video_file:
|
10 |
video_bytes = video_file.read()
|
11 |
-
video_base64 = base64.b64encode(video_bytes).decode(
|
|
|
|
|
12 |
video_html = f"""
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
st.markdown(video_html, unsafe_allow_html=True)
|
21 |
|
22 |
-
# Set the background *before* any other Streamlit elements
|
23 |
-
set_background("numbers moving background.mp4") # Replace with your video path
|
24 |
-
|
25 |
# --- Triangle Calculation and Plotting Functions ---
|
26 |
def calculate_distance(x1, y1, x2, y2):
|
27 |
return np.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
|
|
|
1 |
import streamlit as st
|
2 |
+
def set_background_video():
|
3 |
+
video_path = 'numbers moving background.mp4'
|
4 |
+
with open(video_path, 'rb') as video_file:
|
|
|
|
|
|
|
|
|
|
|
5 |
video_bytes = video_file.read()
|
6 |
+
video_base64 = base64.b64encode(video_bytes).decode('utf-8')
|
7 |
+
|
8 |
+
# Adjust the video HTML
|
9 |
video_html = f"""
|
10 |
+
<video
|
11 |
+
style="position: fixed; right: 0; bottom: 0; min-width: 100%; min-height: 100%; width: auto; height: auto; z-index: -1;"
|
12 |
+
preload="auto"
|
13 |
+
autoplay
|
14 |
+
loop
|
15 |
+
muted
|
16 |
+
>
|
17 |
+
<source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
|
18 |
+
Your browser does not support the video tag.
|
19 |
+
</video>
|
20 |
+
"""
|
21 |
st.markdown(video_html, unsafe_allow_html=True)
|
22 |
|
|
|
|
|
|
|
23 |
# --- Triangle Calculation and Plotting Functions ---
|
24 |
def calculate_distance(x1, y1, x2, y2):
|
25 |
return np.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
|