Daniton commited on
Commit
0f8953d
1 Parent(s): 5bf2fe3

Create app.py

Browse files
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 StableDiffusionPipeline
3
+ import torch
4
+
5
+ model_id = "prompthero/openjourney"
6
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
7
+ pipe = pipe.to("cuda")
8
+
9
+ def generate_image(prompt):
10
+ image = pipe(prompt).images[0]
11
+ return image
12
+
13
+ iface = gr.Interface(generate_image, gr.inputs.Textbox(label="Enter a prompt"), gr.outputs.Image())
14
+ iface.launch()