Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1683,43 +1683,30 @@ def main():
|
|
| 1683 |
# Offer download of processed video
|
| 1684 |
st.success("Video processing complete!")
|
| 1685 |
st.download_button(
|
| 1686 |
-
label="Download Processed Video",
|
| 1687 |
data=processed_video,
|
| 1688 |
file_name=f"processed_{uploaded_file.name}",
|
| 1689 |
mime="video/mp4"
|
| 1690 |
)
|
| 1691 |
|
| 1692 |
-
#
|
| 1693 |
-
st.markdown(""
|
| 1694 |
-
|
| 1695 |
-
- **Option 1:** Download and play the video locally (recommended)
|
| 1696 |
-
- **Option 2:** Try the embedded player below (may not work in all browsers)
|
| 1697 |
|
| 1698 |
-
|
| 1699 |
-
|
| 1700 |
-
|
| 1701 |
-
|
| 1702 |
-
|
| 1703 |
-
|
| 1704 |
-
|
| 1705 |
-
|
| 1706 |
-
|
| 1707 |
-
|
| 1708 |
-
|
| 1709 |
-
|
| 1710 |
-
|
| 1711 |
-
|
| 1712 |
-
video_html = f"""
|
| 1713 |
-
<video width="100%" controls>
|
| 1714 |
-
<source src="data:video/mp4;base64,{b64_video}" type="video/mp4">
|
| 1715 |
-
Your browser does not support the video tag.
|
| 1716 |
-
</video>
|
| 1717 |
-
"""
|
| 1718 |
-
st.markdown(video_html, unsafe_allow_html=True)
|
| 1719 |
-
|
| 1720 |
-
# Keep the regular player as a fallback option
|
| 1721 |
-
st.markdown("### Alternative Player (if HTML player doesn't work)")
|
| 1722 |
-
st.video(processed_video)
|
| 1723 |
|
| 1724 |
# Show detailed analysis results
|
| 1725 |
st.markdown("### Detailed Analysis Results")
|
|
|
|
| 1683 |
# Offer download of processed video
|
| 1684 |
st.success("Video processing complete!")
|
| 1685 |
st.download_button(
|
| 1686 |
+
label="⬇️ Download Processed Video",
|
| 1687 |
data=processed_video,
|
| 1688 |
file_name=f"processed_{uploaded_file.name}",
|
| 1689 |
mime="video/mp4"
|
| 1690 |
)
|
| 1691 |
|
| 1692 |
+
# Extract and display thumbnail frames instead of video playback
|
| 1693 |
+
st.markdown("### Video Preview")
|
| 1694 |
+
st.info("To view the full video with analysis results, please download using the button above and play it locally.")
|
|
|
|
|
|
|
| 1695 |
|
| 1696 |
+
# Show preview frames
|
| 1697 |
+
try:
|
| 1698 |
+
st.markdown("#### Preview Frames")
|
| 1699 |
+
frames = extract_video_frames(processed_video, num_frames=4)
|
| 1700 |
+
|
| 1701 |
+
if frames:
|
| 1702 |
+
cols = st.columns(len(frames))
|
| 1703 |
+
for i, frame in enumerate(frames):
|
| 1704 |
+
with cols[i]:
|
| 1705 |
+
st.image(frame, caption=f"Frame {i+1}", use_container_width=True)
|
| 1706 |
+
else:
|
| 1707 |
+
st.warning("Could not extract preview frames from the video.")
|
| 1708 |
+
except Exception as e:
|
| 1709 |
+
st.error(f"Error extracting preview frames: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1710 |
|
| 1711 |
# Show detailed analysis results
|
| 1712 |
st.markdown("### Detailed Analysis Results")
|