Spaces:
Runtime error
Runtime error
Download app.py from Student3331/simple_video_player: direct link, hf CLI and curl.
- Browser
- Download file 996 Bytes
-
https://huggingface.co/spaces/Student3331/simple_video_player/resolve/main/app.py
- Command line
-
hf download hf://spaces/Student3331/simple_video_player/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Student3331/simple_video_player/resolve/main/app.py
996 Bytes
| import streamlit as st | |
| import cv2 | |
| import numpy as np | |
| # Create a simple Streamlit app for video player | |
| st.title("AI Video Player") | |
| # Create an open button to allow users to paste the video URL | |
| open_url = st.text_input("Paste Video URL Here:") | |
| # If a URL is provided, show the play button | |
| if open_url: | |
| play_button = st.button("Play Video") | |
| # Play the video when the play button is clicked | |
| if play_button: | |
| st.video(open_url, format="video/mp4", start_time=0) | |
| # Control play/pause via buttons (since Streamlit doesn't have native support for play/pause) | |
| pause_button = st.button("Pause Video") | |
| if pause_button: | |
| # Create a logic to pause the video by clearing and restarting (this can be improved) | |
| st.empty() | |
| st.write("Video Paused. Click Play again to resume.") | |
| else: | |
| st.write("Video is playing.") | |
| # Else prompt user to open a URL | |
| else: | |
| st.write("Please paste a URL to start.") | |