File size: 547 Bytes
77725ae
56a5883
6b98260
56a5883
96dae07
 
 
56a5883
96dae07
aacdc51
 
56a5883
 
 
fe2c19a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()