File size: 739 Bytes
d6c1eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
from diffusers import DiffusionPipeline

# Load the model and LoRA weights
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
pipe.load_lora_weights("SvenN/sdxl-emoji")

# Function to generate image
def generate_image(prompt):
    image = pipe(prompt).images[0]
    return image

# Gradio interface
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)

# Launch the app
demo.launch()