video-animator / sampler.py
root
changin g
6879e29
raw
history blame
1.08 kB
import base64
import json
from handler import EndpointHandler
from PIL import Image
import io
# Initialize the handler
handler = EndpointHandler()
# Define sample inputs
inputs = {
"inputs": {
"ref_image_url": "https://cdn.discordapp.com/attachments/1237667074210267217/1246572710679806003/image.jpg?ex=665ce0ce&is=665b8f4e&hm=b8a0caf3080336aac412746681efb7189d5cb4c3e2c0b8ea52696402bbb82a91&",
"video_url": "https://cdn.discordapp.com/attachments/1237667074210267217/1246572710964756593/pose.mp4?ex=665ce0ce&is=665b8f4e&hm=32748799cab55da4040143c5449f497c1440ecd13ba9886e6b12648e1d72e9fc&",
"length": 24,
"num_inference_steps": 25,
"cfg": 3.5,
"seed": 123
}
}
# Simulate an inference call
output = handler(inputs)
# # Decode the base64 video output
video_base64 = output.get("video", "")
video_bytes = base64.b64decode(video_base64)
# Save the video to a file
with open("output_video.mp4", "wb") as video_file:
video_file.write(video_bytes)
print("Inference completed. Output video saved as output_video.mp4")