Spaces:
Runtime error
Runtime error
text
Browse files- app.py +20 -4
- requirements.txt +0 -0
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|