Spaces:
Runtime error
Runtime error
File size: 974 Bytes
80a6752 |
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 35 |
import gradio as gr
from diffusers import DiffusionPipeline
import torch
from PIL import Image
from moviepy.editor import ImageSequenceClip
# Загружаем модель
pipe = DiffusionPipeline.from_pretrained(
"Suparious/FP-image-to-video-FLUX.1-HV-bf16",
torch_dtype=torch.bfloat16,
variant="bf16"
).to("cuda")
pipe.enable_model_cpu_offload()
def animate_image(image: Image.Image):
result = pipe(image, decode_chunk_size=8)
frames = result.frames
clip = ImageSequenceClip(frames, fps=8)
output_path = "output.mp4"
clip.write_videofile(output_path, codec="libx264", audio=False)
return output_path
demo = gr.Interface(
fn=animate_image,
inputs=gr.Image(type="pil"),
outputs=gr.Video(),
title="🌀 FP Image to Video Animation",
description="Загрузи изображение, и модель FLUX.1 превратит его в короткое анимированное видео."
)
demo.launch()
|