Spaces:
Runtime error
Runtime error
File size: 798 Bytes
87c2878 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import json
import ffmpeg
from transformers import Tool
class ImageDirectoryToVideoTool(Tool):
name = "image_directory_video_tool"
description = """
This tool creates video
from a directory of images. Inputs
are input_path and output_path.
Output is the output_path.
"""
inputs = ["text", "text"]
outputs = ["text"]
def __call__(
self,
input_path: str,
output_path: str,
framerate: int = 25,
extension: str = "jpg",
):
(
ffmpeg.input(
input_path.rstrip("/") + "/*." + extension.lstrip("."),
pattern_type="glob",
framerate=framerate,
)
.output(output_path)
.run()
)
return output_path
|