INNER CODE UNIT · Python
seed
Tencent-Hunyuan/HunyuanPortrait · gradio_app.py:180
seed = random.randint(0, 2**32 - 1)
seed_everything(seed)
print(f"Using seed: {seed}")
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
# Save inputs to temp directory
image_path = os.path.join(tmp_path, f"{timestamp}_src.png")
# Handle image input (Gradio sends PIL Image or path)
if isinstance(image_input, np.ndarray):
Image.fromarray(image_input).save(image_path)
elif isinstance(image_input, Image.Image):
image_input.save(image_path)
elif isinstance(image_input, str):
image_path = image_input
video_path = video_input