Text2Image / app.py
mkoot007's picture
Create app.py
189f0af
raw
history blame
No virus
600 Bytes
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
# Load the model and set up the pipeline
model_id = "prompthero/openjourney"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
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()