fjenett commited on
Commit
9fe573e
1 Parent(s): aaf592c
Files changed (2) hide show
  1. app.py +20 -4
  2. requirements.txt +0 -0
app.py CHANGED
@@ -1,7 +1,23 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
+ import torch
4
 
5
+ pipeline = DiffusionPipeline.from_pretrained("dreamlike-art/dreamlike-photoreal-2.0")
 
6
 
7
+ # move to GPU if available
8
+ if torch.cuda.is_available():
9
+ pipeline = pipeline.to("cuda")
10
+
11
+ def generate(prompts):
12
+ images = pipeline(list(prompts)).images
13
+ return [images]
14
+
15
+ demo = gr.Interface(generate,
16
+ "textbox",
17
+ "image",
18
+ batch=True,
19
+ max_batch_size=4 # Set the batch size based on your CPU/GPU memory
20
+ ).queue()
21
+
22
+ if __name__ == "__main__":
23
+ demo.launch()
requirements.txt ADDED
File without changes