Mayer21 commited on
Commit
9c65aaa
·
1 Parent(s): 4e68fe0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import StableDiffusionPipeline
2
+ import gradio as gr
3
+ import torch
4
+
5
+ model_id = "dreamlike-art/dreamlike-diffusion-1.0"
6
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
7
+ pipe = pipe.to("cuda")
8
+
9
+ def text_to_image(prompt):
10
+ image = pipe(prompt, num_images_per_prompt=3).images
11
+ return image
12
+
13
+ gr.Interface(
14
+ fn=text_to_image,
15
+ inputs=gr.Text(),
16
+ outputs=gr.Gallery().style(grid=[3])
17
+ ).launch()