Spaces:
Runtime error
Runtime error
File size: 420 Bytes
0f8953d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
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(generate_image, gr.inputs.Textbox(label="Enter a prompt"), gr.outputs.Image())
iface.launch()
|