Spaces:
No application file
No application file
Upload app.py
#1
by ScaziPWNZ - opened
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from diffusers import StableDiffusionGLIGENPipeline
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
pipe = StableDiffusionGLIGENPipeline.from_pretrained(
|
| 6 |
+
"masterful/gligen-1-4-generation-text-box",
|
| 7 |
+
torch_dtype=torch.float16
|
| 8 |
+
).to("cuda" if torch.cuda.is_available() else "cpu")
|
| 9 |
+
|
| 10 |
+
def generate_image(prompt):
|
| 11 |
+
image = pipe(prompt).images[0]
|
| 12 |
+
return image
|
| 13 |
+
|
| 14 |
+
gr.Interface(fn=generate_image, inputs="text", outputs="image").launch()
|