ysharma HF staff commited on
Commit
f22c5cc
1 Parent(s): d2daeb5
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -164,16 +164,16 @@ def get_gif_timestamps(giflist_indxs, words_timestamp):
164
  def gen_moviepy_gif(start_seconds, end_seconds):
165
  print("******** inside moviepy_gif () ***************")
166
  video_path = "./ShiaLaBeouf.mp4"
167
- video = mp.VideoFileClip(video_path)
168
  final_clip = video.subclip(start_seconds, end_seconds)
169
  #final_clip.write_videofile("/content/gdrive/My Drive/AI/videoedit/gif1.mp4")
170
- final_clip.write_gif("gifimage.gif", program='ffmpeg', tempfiles=True, fps=15, fuzz=3)
171
  print("I am here now")
172
  #im = Image.open(r"./gifimage.gif")
173
- #gif_img = mp.VideoFileClip("./gifimage.gif")
174
  #final_clip.close()
175
  print("At the very end")
176
- return
177
 
178
 
179
  sample_video = ['./ShiaLaBeouf.mp4']
@@ -184,6 +184,7 @@ examples = gr.components.Dataset(components=[sample_vid], samples=[sample_video]
184
  demo = gr.Blocks()
185
 
186
  with demo:
 
187
  with gr.Row():
188
  input_video = gr.Video(label="Upload a Video", visible=True) #for incoming video
189
  text_transcript = gr.Textbox(label="Transcripts", lines = 10, interactive = True ) #to generate and display transcriptions for input video
 
164
  def gen_moviepy_gif(start_seconds, end_seconds):
165
  print("******** inside moviepy_gif () ***************")
166
  video_path = "./ShiaLaBeouf.mp4"
167
+ video = mp.VideoFileClip(video_path).resize(0.3)
168
  final_clip = video.subclip(start_seconds, end_seconds)
169
  #final_clip.write_videofile("/content/gdrive/My Drive/AI/videoedit/gif1.mp4")
170
+ final_clip.write_gif("gifimage.gif") #, program='ffmpeg', tempfiles=True, fps=15, fuzz=3)
171
  print("I am here now")
172
  #im = Image.open(r"./gifimage.gif")
173
+ gif_img = mp.VideoFileClip("gifimage.gif")
174
  #final_clip.close()
175
  print("At the very end")
176
+ return gif_img
177
 
178
 
179
  sample_video = ['./ShiaLaBeouf.mp4']
 
184
  demo = gr.Blocks()
185
 
186
  with demo:
187
+ with gr.Markdown("This app is still a work in progress..")
188
  with gr.Row():
189
  input_video = gr.Video(label="Upload a Video", visible=True) #for incoming video
190
  text_transcript = gr.Textbox(label="Transcripts", lines = 10, interactive = True ) #to generate and display transcriptions for input video