Spaces:
Runtime error
Runtime error
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() |