Spaces:
Runtime error
Runtime error
import gradio as gr | |
from diffusers import DiffusionPipeline | |
# Load the Stable Video Diffusion pipeline (image to video model) | |
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid-xt") | |
def generate_image(prompt): | |
# Generate the image from the prompt | |
result = pipe(prompt) | |
image = result.images[0] # Extract the first frame | |
return image | |
# Create a Gradio interface | |
iface = gr.Interface( | |
fn=generate_image, | |
inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g. Astronaut in a jungle"), | |
outputs=gr.Image(label="Generated Image"), | |
title="Stable Video Diffusion - Image to Video", | |
description="Generate images (first frame) using Stable Video Diffusion based on your prompts." | |
) | |
if __name__ == "__main__": | |
iface.launch() | |