File size: 458 Bytes
0f8953d
 
 
c4d1084
0f8953d
 
 
 
 
 
c4d1084
0f8953d
 
c4d1084
 
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
import numpy as np

model_id = "prompthero/openjourney"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)

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

iface = gr.Interface(generate_image, gr.inputs.Textbox(label="Enter a prompt"), gr.outputs.Image(type='numpy'))
iface.launch()