Spaces:
Runtime error
Runtime error
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 | |