INNER CODE UNIT · Python

soft_mask

Tencent-Hunyuan/HunyuanPortrait · gradio_app.py:345

    soft_mask = create_soft_mask((x2 - x1, y2 - y1))
    
    for i in range(len(generated_frames)):
        gen_frame = generated_frames[i]
        full_frame = paste_back_frame(original_image, gen_frame, crop_bbox, soft_mask)
        final_frames.append(Image.fromarray(full_frame))

    print(f"Saving videos to {job_dir} with FPS {fps}")
    save_videos_grid(video, save_video_path_crop, n_rows=1, fps=fps)
    save_videos_from_pil(final_frames, save_video_path_full, fps=fps)
    
    return save_video_path_crop, save_video_path_full

# --- 4. Gradio Interface ---

with gr.Blocks(theme=gr.themes.Soft(), title="HunyuanPortrait") as demo:
    gr.Markdown(
        """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…