Spaces:
Runtime error
Runtime error
seanwendlandt
commited on
Commit
•
086b0d1
1
Parent(s):
165c0db
Upload 4 files
Browse files- .gitattributes +2 -0
- SelfBuildingCar.gif +3 -0
- Shimmerbub.gif +3 -0
- app.py +26 -0
- requirements.txt +2 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
SelfBuildingCar.gif filter=lfs diff=lfs merge=lfs -text
|
37 |
+
Shimmerbub.gif filter=lfs diff=lfs merge=lfs -text
|
SelfBuildingCar.gif
ADDED
Git LFS Details
|
Shimmerbub.gif
ADDED
Git LFS Details
|
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from moviepy.editor import VideoFileClip
|
3 |
+
import os
|
4 |
+
|
5 |
+
st.title('Video to GIF converter')
|
6 |
+
|
7 |
+
uploaded_file = st.file_uploader("Choose a video...", type=["mp4", "mov", "avi", "mkv"])
|
8 |
+
|
9 |
+
if uploaded_file is not None:
|
10 |
+
with open("temp_video.mp4", "wb") as f:
|
11 |
+
f.write(uploaded_file.getbuffer())
|
12 |
+
|
13 |
+
st.success('Video uploaded successfully!')
|
14 |
+
|
15 |
+
start_time = st.number_input('Enter the start time (in seconds)', min_value=0, value=0, step=1)
|
16 |
+
duration = st.number_input('Enter the duration of the clip (in seconds)', min_value=1, value=5, step=1)
|
17 |
+
resolution = st.number_input('Enter the height resolution (in pixels)', min_value=1, value=480, step=1)
|
18 |
+
|
19 |
+
if st.button('Create GIF'):
|
20 |
+
video = VideoFileClip("temp_video.mp4")
|
21 |
+
clip = video.subclip(start_time, start_time + duration)
|
22 |
+
clip_resized = clip.resize(height=resolution)
|
23 |
+
clip_resized.write_gif("output.gif", fps=clip.fps)
|
24 |
+
|
25 |
+
st.success('GIF created successfully! Check your directory for a file named "output.gif".')
|
26 |
+
os.remove("temp_video.mp4") # remove the temporary video file
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
moviepy
|