File size: 373 Bytes
bb0c49c
 
b6fa31c
bb0c49c
 
 
 
73943a0
 
 
 
 
 
 
 
 
bb0c49c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from diffusers import StableDiffusionPipeline
import torch
import gradio as gr

model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)

def predict(prompt):
    image = pipe(prompt).images[0]
    return image

demo = gr.Interface(fn=predict, inputs="text", outputs="image")

demo.launch()