Tempuror commited on
Commit
56a5883
·
1 Parent(s): e073d5f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def generate_poster(prompt):
4
+ model_path = "sd-poster-model"
5
+ pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
6
+ pipe.unet.load_attn_procs(model_path)
7
+ pipe.to("cuda")
8
+
9
+ image = pipe(prompt, num_inference_steps=100, guidance_scale=50).images[0]
10
+ return image
11
+
12
+ interface = gr.Interface(fn=generate_poster, inputs="text", outputs="image", title="Poster Generator")
13
+ interface.launch(inline = False)