Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,13 @@
|
|
| 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 |
|
|
@@ -20,6 +17,4 @@ with gr.Blocks() as demo:
|
|
| 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()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from diffusers import DiffusionPipeline
|
| 3 |
|
|
|
|
| 4 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
|
| 5 |
pipe.load_lora_weights("SvenN/sdxl-emoji")
|
| 6 |
|
|
|
|
| 7 |
def generate_image(prompt):
|
| 8 |
image = pipe(prompt).images[0]
|
| 9 |
return image
|
| 10 |
|
|
|
|
| 11 |
with gr.Blocks() as demo:
|
| 12 |
gr.Markdown("## Stable Diffusion XL Emoji Generator")
|
| 13 |
|
|
|
|
| 17 |
generate_button = gr.Button("Generate")
|
| 18 |
|
| 19 |
generate_button.click(fn=generate_image, inputs=prompt, outputs=image_output)
|
|
|
|
|
|
|
| 20 |
demo.launch()
|