mkoot007 commited on
Commit
189f0af
1 Parent(s): ce8d804

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ # Load the model and set up the pipeline
6
+ model_id = "prompthero/openjourney"
7
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
8
+ pipe = pipe.to("cuda")
9
+
10
+ def generate_image(prompt):
11
+ image = pipe(prompt).images[0]
12
+ return image
13
+
14
+ iface = gr.Interface(
15
+ fn=generate_image,
16
+ inputs=gr.Textbox(prompt="Enter a prompt:"),
17
+ outputs=gr.Image(),
18
+ title="Image Generation Model",
19
+ description="Generate images from text prompts using the OpenJourney model.",
20
+ )
21
+
22
+ iface.launch()