Spaces:
Runtime error
Runtime error
import torch | |
import gradio as gr | |
from diffusers import StableDiffusionPipeline | |
model_path = "sd-poster-model" | |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float32) | |
pipe.unet.load_attn_procs(model_path) | |
def generate_poster(prompt): | |
print("start generating image", prompt) | |
image = pipe(prompt, num_inference_steps=10, guidance_scale=50).images[0] | |
return image | |
interface = gr.Interface(fn=generate_poster, inputs="text", outputs="image", title="Poster Generator") | |
interface.launch() |