File size: 563 Bytes
189f0af
 
30a6fe5
189f0af
7383dff
189f0af
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch  # Import the torch library
model_id = "prompthero/openjourney"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)

def generate_image(prompt):
    image = pipe(prompt).images[0]
    return image

iface = gr.Interface(
    fn=generate_image,
    inputs=gr.Textbox(prompt="Enter a prompt:"),
    outputs=gr.Image(),
    title="Image Generation Model",
    description="Generate images from text prompts using the OpenJourney model.",
)

iface.launch()