Files changed (1) hide show
  1. app.py +14 -0
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()