File size: 514 Bytes
0f8953d
 
 
c4d1084
0f8953d
ae2ae85
826a032
19fcbaa
826a032
0f8953d
 
 
c4d1084
0f8953d
 
3e6114b
 
c4d1084
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
import numpy as np

model_id = "Joeythemonster/anything-midjourney-v-4-1"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
pipe = pipe.to("cpu")


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'), batch_size=1)

iface.launch()