1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

Update export to video to support new tensor_to_vid function in video pipelines (#6715)

update
This commit is contained in:
Dhruv Nair
2024-01-30 19:43:33 +05:30
committed by GitHub
parent b09b90e24c
commit 8e94663503

View File

@@ -125,7 +125,10 @@ def export_to_video(
if output_video_path is None:
output_video_path = tempfile.NamedTemporaryFile(suffix=".mp4").name
if isinstance(video_frames[0], PIL.Image.Image):
if isinstance(video_frames[0], np.ndarray):
video_frames = [(frame * 255).astype(np.uint8) for frame in video_frames]
elif isinstance(video_frames[0], PIL.Image.Image):
video_frames = [np.array(frame) for frame in video_frames]
fourcc = cv2.VideoWriter_fourcc(*"mp4v")