mirror of
https://github.com/THUDM/CogVideo.git
synced 2025-04-05 03:04:56 +08:00
upgrade to moviepy v2
This commit is contained in:
parent
8f1829f1cd
commit
70ca65300c
@ -41,7 +41,7 @@ pip install -r requirements.txt
|
||||
## Running the code
|
||||
|
||||
```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 openai import OpenAI
|
||||
import moviepy.editor as mp
|
||||
from moviepy import VideoFileClip
|
||||
import utils
|
||||
from rife_model import load_rife_model, rife_inference_with_latents
|
||||
from huggingface_hub import hf_hub_download, snapshot_download
|
||||
@ -271,9 +271,9 @@ def infer(
|
||||
|
||||
|
||||
def convert_to_gif(video_path):
|
||||
clip = mp.VideoFileClip(video_path)
|
||||
clip = clip.set_fps(8)
|
||||
clip = clip.resize(height=240)
|
||||
clip = VideoFileClip(video_path)
|
||||
clip = clip.with_fps(8)
|
||||
clip = clip.resized(height=240)
|
||||
gif_path = video_path.replace(".mp4", ".gif")
|
||||
clip.write_gif(gif_path, fps=8)
|
||||
return gif_path
|
||||
|
@ -15,5 +15,5 @@ gradio>=5.4.0
|
||||
imageio>=2.34.2
|
||||
imageio-ffmpeg>=0.5.1
|
||||
openai>=1.45.0
|
||||
moviepy>=1.0.3
|
||||
moviepy>=2.0.0
|
||||
pillow==9.5.0
|
@ -20,7 +20,7 @@ from diffusers import CogVideoXPipeline
|
||||
from diffusers.utils import export_to_video
|
||||
from datetime import datetime, timedelta
|
||||
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")
|
||||
|
||||
@ -117,9 +117,9 @@ def save_video(tensor):
|
||||
|
||||
|
||||
def convert_to_gif(video_path):
|
||||
clip = mp.VideoFileClip(video_path)
|
||||
clip = clip.set_fps(8)
|
||||
clip = clip.resize(height=240)
|
||||
clip = VideoFileClip(video_path)
|
||||
clip = clip.with_fps(8)
|
||||
clip = clip.resized(height=240)
|
||||
gif_path = video_path.replace(".mp4", ".gif")
|
||||
clip.write_gif(gif_path, fps=8)
|
||||
return gif_path
|
||||
|
@ -10,5 +10,5 @@ gradio>=5.5.0
|
||||
imageio>=2.35.1
|
||||
imageio-ffmpeg>=0.5.1
|
||||
openai>=1.54.0
|
||||
moviepy>=1.0.3
|
||||
moviepy>=2.0.0
|
||||
scikit-video>=1.1.11
|
@ -12,7 +12,7 @@ from transformers import AutoTokenizer
|
||||
from datetime import datetime, timedelta
|
||||
import threading
|
||||
import time
|
||||
import moviepy.editor as mp
|
||||
from moviepy import VideoFileClip
|
||||
|
||||
torch.set_float32_matmul_precision("high")
|
||||
|
||||
@ -140,9 +140,9 @@ def save_video(tensor):
|
||||
|
||||
|
||||
def convert_to_gif(video_path):
|
||||
clip = mp.VideoFileClip(video_path)
|
||||
clip = clip.set_fps(8)
|
||||
clip = clip.resize(height=240)
|
||||
clip = VideoFileClip(video_path)
|
||||
clip = clip.with_fps(8)
|
||||
clip = clip.resized(height=240)
|
||||
gif_path = video_path.replace(".mp4", ".gif")
|
||||
clip.write_gif(gif_path, fps=8)
|
||||
return gif_path
|
||||
|
@ -26,7 +26,7 @@ build:
|
||||
- imageio>=2.35.1
|
||||
- imageio-ffmpeg>=0.5.1
|
||||
- openai>=1.45.0
|
||||
- moviepy>=1.0.3
|
||||
- moviepy>=2.0.0
|
||||
- pillow==9.5.0
|
||||
- pydantic==1.10.7
|
||||
run:
|
||||
|
Loading…
x
Reference in New Issue
Block a user