Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2231,38 +2231,4 @@ def extract_video_frames(video_bytes, num_frames=5):
|
|
2231 |
import os
|
2232 |
os.unlink(temp_video_path)
|
2233 |
|
2234 |
-
return frames
|
2235 |
-
|
2236 |
-
# Then add this where you display the video
|
2237 |
-
if processed_video:
|
2238 |
-
# Offer download of processed video
|
2239 |
-
st.success("Video processing complete!")
|
2240 |
-
st.download_button(
|
2241 |
-
label="Download Processed Video",
|
2242 |
-
data=processed_video,
|
2243 |
-
file_name=f"processed_{uploaded_file.name}",
|
2244 |
-
mime="video/mp4"
|
2245 |
-
)
|
2246 |
-
|
2247 |
-
# Extract and display thumbnail frames
|
2248 |
-
st.markdown("### Video Preview Frames")
|
2249 |
-
st.info("The video may not play in all browsers. Here are preview frames from the processed video.")
|
2250 |
-
|
2251 |
-
try:
|
2252 |
-
frames = extract_video_frames(processed_video, num_frames=4)
|
2253 |
-
|
2254 |
-
if frames:
|
2255 |
-
cols = st.columns(len(frames))
|
2256 |
-
for i, frame in enumerate(frames):
|
2257 |
-
with cols[i]:
|
2258 |
-
st.image(frame, caption=f"Frame {i+1}", use_container_width=True)
|
2259 |
-
|
2260 |
-
st.markdown("Download the full video for proper playback.")
|
2261 |
-
else:
|
2262 |
-
st.warning("Could not extract preview frames from the video.")
|
2263 |
-
except Exception as e:
|
2264 |
-
st.error(f"Error extracting frames: {str(e)}")
|
2265 |
-
|
2266 |
-
# Regular video display as fallback
|
2267 |
-
st.markdown("### Processed Video (Player may not work in all browsers)")
|
2268 |
-
st.video(processed_video)
|
|
|
2231 |
import os
|
2232 |
os.unlink(temp_video_path)
|
2233 |
|
2234 |
+
return frames
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|