File size: 1,114 Bytes
dd31ccf
 
 
 
 
 
 
 
 
 
 
 
68fad5b
0be44e5
2797e34
dd31ccf
 
 
 
 
 
 
 
 
2797e34
0be44e5
 
dd31ccf
0be44e5
 
 
dd31ccf
 
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
34
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")