aliabd commited on
Commit
c02844f
Β·
1 Parent(s): e0ff983

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import DiffusionPipeline
2
+ import gradio as gr
3
+
4
+ generator = DiffusionPipeline.from_pretrained("CompVis/ldm-text2im-large-256")
5
+ # generator.to("cuda") # If you have a GPU, uncomment this line
6
+
7
+ def generate(prompts):
8
+ images = generator(list(prompts)).images
9
+ return [images]
10
+
11
+ gr.Interface(generate,
12
+ "textbox",
13
+ "image",
14
+ batch=True,
15
+ max_batch_size=4 # Set the batch size based on your CPU/GPU memory
16
+ ).queue().launch()