mirror of
https://github.com/THUDM/CogVideo.git
synced 2025-04-06 03:57:56 +08:00
Merge pull request #652 from erfanasgari21/moviepy-v2
Update code and requirements to support Moviepy v2
This commit is contained in:
commit
ea994c75c2
@ -41,7 +41,7 @@ pip install -r requirements.txt
|
|||||||
## Running the code
|
## Running the code
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python gradio_web_demo.py
|
python app.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ from datetime import datetime, timedelta
|
|||||||
|
|
||||||
from diffusers.image_processor import VaeImageProcessor
|
from diffusers.image_processor import VaeImageProcessor
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
import moviepy.editor as mp
|
from moviepy import VideoFileClip
|
||||||
import utils
|
import utils
|
||||||
from rife_model import load_rife_model, rife_inference_with_latents
|
from rife_model import load_rife_model, rife_inference_with_latents
|
||||||
from huggingface_hub import hf_hub_download, snapshot_download
|
from huggingface_hub import hf_hub_download, snapshot_download
|
||||||
@ -271,9 +271,9 @@ def infer(
|
|||||||
|
|
||||||
|
|
||||||
def convert_to_gif(video_path):
|
def convert_to_gif(video_path):
|
||||||
clip = mp.VideoFileClip(video_path)
|
clip = VideoFileClip(video_path)
|
||||||
clip = clip.set_fps(8)
|
clip = clip.with_fps(8)
|
||||||
clip = clip.resize(height=240)
|
clip = clip.resized(height=240)
|
||||||
gif_path = video_path.replace(".mp4", ".gif")
|
gif_path = video_path.replace(".mp4", ".gif")
|
||||||
clip.write_gif(gif_path, fps=8)
|
clip.write_gif(gif_path, fps=8)
|
||||||
return gif_path
|
return gif_path
|
||||||
|
@ -15,5 +15,5 @@ gradio>=5.4.0
|
|||||||
imageio>=2.34.2
|
imageio>=2.34.2
|
||||||
imageio-ffmpeg>=0.5.1
|
imageio-ffmpeg>=0.5.1
|
||||||
openai>=1.45.0
|
openai>=1.45.0
|
||||||
moviepy>=1.0.3
|
moviepy>=2.0.0
|
||||||
pillow==9.5.0
|
pillow==9.5.0
|
@ -20,7 +20,7 @@ from diffusers import CogVideoXPipeline
|
|||||||
from diffusers.utils import export_to_video
|
from diffusers.utils import export_to_video
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
import moviepy.editor as mp
|
from moviepy import VideoFileClip
|
||||||
|
|
||||||
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16).to("cuda")
|
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16).to("cuda")
|
||||||
|
|
||||||
@ -117,9 +117,9 @@ def save_video(tensor):
|
|||||||
|
|
||||||
|
|
||||||
def convert_to_gif(video_path):
|
def convert_to_gif(video_path):
|
||||||
clip = mp.VideoFileClip(video_path)
|
clip = VideoFileClip(video_path)
|
||||||
clip = clip.set_fps(8)
|
clip = clip.with_fps(8)
|
||||||
clip = clip.resize(height=240)
|
clip = clip.resized(height=240)
|
||||||
gif_path = video_path.replace(".mp4", ".gif")
|
gif_path = video_path.replace(".mp4", ".gif")
|
||||||
clip.write_gif(gif_path, fps=8)
|
clip.write_gif(gif_path, fps=8)
|
||||||
return gif_path
|
return gif_path
|
||||||
|
@ -10,6 +10,6 @@ gradio>=5.5.0
|
|||||||
imageio>=2.35.1
|
imageio>=2.35.1
|
||||||
imageio-ffmpeg>=0.5.1
|
imageio-ffmpeg>=0.5.1
|
||||||
openai>=1.54.0
|
openai>=1.54.0
|
||||||
moviepy>=1.0.3
|
moviepy>=2.0.0
|
||||||
scikit-video>=1.1.11
|
scikit-video>=1.1.11
|
||||||
pydantic>=2.10.3
|
pydantic>=2.10.3
|
@ -12,7 +12,7 @@ from transformers import AutoTokenizer
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import moviepy.editor as mp
|
from moviepy import VideoFileClip
|
||||||
|
|
||||||
torch.set_float32_matmul_precision("high")
|
torch.set_float32_matmul_precision("high")
|
||||||
|
|
||||||
@ -140,9 +140,9 @@ def save_video(tensor):
|
|||||||
|
|
||||||
|
|
||||||
def convert_to_gif(video_path):
|
def convert_to_gif(video_path):
|
||||||
clip = mp.VideoFileClip(video_path)
|
clip = VideoFileClip(video_path)
|
||||||
clip = clip.set_fps(8)
|
clip = clip.with_fps(8)
|
||||||
clip = clip.resize(height=240)
|
clip = clip.resized(height=240)
|
||||||
gif_path = video_path.replace(".mp4", ".gif")
|
gif_path = video_path.replace(".mp4", ".gif")
|
||||||
clip.write_gif(gif_path, fps=8)
|
clip.write_gif(gif_path, fps=8)
|
||||||
return gif_path
|
return gif_path
|
||||||
|
@ -26,7 +26,7 @@ build:
|
|||||||
- imageio>=2.35.1
|
- imageio>=2.35.1
|
||||||
- imageio-ffmpeg>=0.5.1
|
- imageio-ffmpeg>=0.5.1
|
||||||
- openai>=1.45.0
|
- openai>=1.45.0
|
||||||
- moviepy>=1.0.3
|
- moviepy>=2.0.0
|
||||||
- pillow==9.5.0
|
- pillow==9.5.0
|
||||||
- pydantic==1.10.7
|
- pydantic==1.10.7
|
||||||
run:
|
run:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user