Spaces:
Runtime error
Runtime error
File size: 463 Bytes
0f8953d 38d46be 0f8953d 38d46be 0f8953d 9c55711 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
from PIL import Image
model_id = "prompthero/openjourney"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
def generate_image(prompt):
image = pipe(prompt).images[0]
image = Image.fromarray(image.numpy())
return image
iface = gr.Interface(generate_image, gr.inputs.Textbox(label="Enter a prompt"), gr.outputs.Image())
iface.launch()
|