Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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)
|