Fix old moviepy

#59
by multimodalart HF Staff - opened
Files changed (2) hide show
  1. app.py +3 -3
  2. requirements.txt +1 -1
app.py CHANGED
@@ -9,7 +9,7 @@ from diffusers.utils import export_to_video
9
  from datetime import datetime, timedelta
10
  from openai import OpenAI
11
  import spaces
12
- import moviepy.editor as mp
13
 
14
  dtype = torch.float16
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -105,8 +105,8 @@ def save_video(tensor):
105
 
106
  def convert_to_gif(video_path):
107
  clip = mp.VideoFileClip(video_path)
108
- clip = clip.set_fps(8)
109
- clip = clip.resize(height=240)
110
  gif_path = video_path.replace(".mp4", ".gif")
111
  clip.write_gif(gif_path, fps=8)
112
  return gif_path
 
9
  from datetime import datetime, timedelta
10
  from openai import OpenAI
11
  import spaces
12
+ import moviepy as mp
13
 
14
  dtype = torch.float16
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
105
 
106
  def convert_to_gif(video_path):
107
  clip = mp.VideoFileClip(video_path)
108
+ clip = clip.with_fps(8)
109
+ clip = clip.resized(height=240)
110
  gif_path = video_path.replace(".mp4", ".gif")
111
  clip.write_gif(gif_path, fps=8)
112
  return gif_path
requirements.txt CHANGED
@@ -2,7 +2,7 @@ imageio-ffmpeg==0.5.1
2
  diffusers==0.30.1
3
  numpy==1.26.0
4
  transformers==4.44.2
5
- moviepy==1.0.3
6
  openai==1.42.0
7
  git+https://github.com/huggingface/accelerate.git@main#egg=accelerate
8
  sentencepiece==0.2.0
 
2
  diffusers==0.30.1
3
  numpy==1.26.0
4
  transformers==4.44.2
5
+ moviepy==2.2.1
6
  openai==1.42.0
7
  git+https://github.com/huggingface/accelerate.git@main#egg=accelerate
8
  sentencepiece==0.2.0