Kvikontent's picture
Update app.py
b09c04c verified
raw
history blame
615 Bytes
import gradio as gr
import spaces
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float32)
@spaces.GPU(duration=120)
def generate_image(prompt):
# Run the diffusion model to generate an image
image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5)
return image
gr_interface = gr.Interface(
fn=generate_image,
inputs="text",
outputs="image",
title="Real-time Image Generation with Diffusion",
description="Enter a prompt to generate an image",
theme="soft"
)
# Launch the Gradio app
gr_interface.launch()