Shangkhonil commited on
Commit
d6c1eb0
1 Parent(s): b960c01

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
+
4
+ # Load the model and LoRA weights
5
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
6
+ pipe.load_lora_weights("SvenN/sdxl-emoji")
7
+
8
+ # Function to generate image
9
+ def generate_image(prompt):
10
+ image = pipe(prompt).images[0]
11
+ return image
12
+
13
+ # Gradio interface
14
+ with gr.Blocks() as demo:
15
+ gr.Markdown("## Stable Diffusion XL Emoji Generator")
16
+
17
+ prompt = gr.Textbox(label="Enter prompt", placeholder="<s0><s1>", value="<s0><s1>")
18
+ image_output = gr.Image(label="Generated Image")
19
+
20
+ generate_button = gr.Button("Generate")
21
+
22
+ generate_button.click(fn=generate_image, inputs=prompt, outputs=image_output)
23
+
24
+ # Launch the app
25
+ demo.launch()