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