Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -64,36 +64,6 @@ Early wildfire detection using YOLOv8 AI vision model. See detected results abov
|
|
64 |
Click on video frames to load and play examples.
|
65 |
""")
|
66 |
|
67 |
-
# Function to create simple video pair HTML
|
68 |
-
def create_video_pair(orig_url, proc_url):
|
69 |
-
try:
|
70 |
-
orig_bytes = requests.get(orig_url).content
|
71 |
-
proc_bytes = requests.get(proc_url).content
|
72 |
-
orig_b64 = base64.b64encode(orig_bytes).decode('utf-8')
|
73 |
-
proc_b64 = base64.b64encode(proc_bytes).decode('utf-8')
|
74 |
-
|
75 |
-
html = f"""
|
76 |
-
<div style="display: flex; gap: 10px; margin-bottom: 20px;">
|
77 |
-
<div style="flex: 1;">
|
78 |
-
<h4>Original</h4>
|
79 |
-
<video width="100%" controls>
|
80 |
-
<source src="data:video/mp4;base64,{orig_b64}" type="video/mp4">
|
81 |
-
Your browser does not support the video tag.
|
82 |
-
</video>
|
83 |
-
</div>
|
84 |
-
<div style="flex: 1;">
|
85 |
-
<h4>Processed</h4>
|
86 |
-
<video width="100%" controls>
|
87 |
-
<source src="data:video/mp4;base64,{proc_b64}" type="video/mp4">
|
88 |
-
Your browser does not support the video tag.
|
89 |
-
</video>
|
90 |
-
</div>
|
91 |
-
</div>
|
92 |
-
"""
|
93 |
-
return html
|
94 |
-
except Exception as e:
|
95 |
-
return f"<p>Error loading videos: {str(e)}</p>"
|
96 |
-
|
97 |
if not source_file:
|
98 |
st.info("Please upload a file to begin.")
|
99 |
|
@@ -101,18 +71,6 @@ st.header("Your Results")
|
|
101 |
result_cols = st.columns(2)
|
102 |
viewer_slot = st.empty()
|
103 |
|
104 |
-
# Example videos (LA before T)
|
105 |
-
st.header("Example Results")
|
106 |
-
examples = [
|
107 |
-
("LA Example", "LA1.mp4", "LA2.mp4"),
|
108 |
-
("T Example", "T1.mp4", "T2.mp4")
|
109 |
-
]
|
110 |
-
for title, orig_file, proc_file in examples:
|
111 |
-
st.subheader(title)
|
112 |
-
orig_url = f"https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/{orig_file}"
|
113 |
-
proc_url = f"https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/{proc_file}"
|
114 |
-
video_html = create_video_pair(orig_url, proc_url)
|
115 |
-
st.markdown(video_html, unsafe_allow_html=True)
|
116 |
|
117 |
# Load model
|
118 |
try:
|
|
|
64 |
Click on video frames to load and play examples.
|
65 |
""")
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
if not source_file:
|
68 |
st.info("Please upload a file to begin.")
|
69 |
|
|
|
71 |
result_cols = st.columns(2)
|
72 |
viewer_slot = st.empty()
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
# Load model
|
76 |
try:
|