File size: 692 Bytes
d6c1eb0
 
929c5eb
d6c1eb0
 
929c5eb
 
d6c1eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
929c5eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from diffusers import DiffusionPipeline
from peft import PeftModel

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")

pipe.unet = PeftModel.from_pretrained(pipe.unet, "SvenN/sdxl-emoji")

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

with gr.Blocks() as demo:
    gr.Markdown("## Stable Diffusion XL Emoji Generator")

    prompt = gr.Textbox(label="Enter prompt", placeholder="<s0><s1>", value="<s0><s1>")
    image_output = gr.Image(label="Generated Image")

    generate_button = gr.Button("Generate")

    generate_button.click(fn=generate_image, inputs=prompt, outputs=image_output)
demo.launch()