| 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://media.discordapp.net/attachments/1237667074210267217/1246013998042976276/image.jpg?ex=665ad876&is=665986f6&hm=e7f0e6fd51c1068c15f1a750ca97abb4b2a4bfed396160ff44cf1abecb489d11&=&format=webp&width=896&height=1194", | |
| "video_url": "https://cdn.discordapp.com/attachments/1237667074210267217/1245971599660679208/pose.mov?ex=665ab0fa&is=66595f7a&hm=63691e23a23ebd8657a10ec708d63a06046a124c3940aa133de22a94aa1fd6c5&", | |
| "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") | |