Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
from diffusers import StableDiffusionPipeline, DiffusionPipeline
|
| 2 |
import torch
|
| 3 |
import gradio as gr
|
|
|
|
| 4 |
import spaces
|
| 5 |
|
| 6 |
css = """
|
| 7 |
#img-display-output {
|
| 8 |
-
max-height:
|
| 9 |
}
|
| 10 |
|
| 11 |
#img-display-output *{
|
| 12 |
-
max-height:
|
| 13 |
}
|
| 14 |
"""
|
| 15 |
|
|
@@ -22,8 +23,9 @@ pipe.to("cuda")
|
|
| 22 |
@spaces.GPU(enable_queue=True)
|
| 23 |
def generate_sprite(prompt):
|
| 24 |
# pipe = pipe.to(DEVICE)
|
| 25 |
-
image = pipe(prompt).images[0]
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
title = "# SD_PixelArt_SpriteSheet_Generator"
|
| 29 |
description = """Pixel Art Sprite Sheet Generator with Stable Diffusion Checkpoint."""
|
|
@@ -34,7 +36,8 @@ with gr.Blocks(css=css) as API:
|
|
| 34 |
|
| 35 |
with gr.Column():
|
| 36 |
inputs=gr.TextArea(label="Prompt", placeholder="Prompt")
|
| 37 |
-
outputs=gr.Image(label="Ouput Image", type='pil', elem_id="img-display-output")
|
|
|
|
| 38 |
generate_btn = gr.Button(value="Generate")
|
| 39 |
generate_btn.click(generate_sprite, inputs=inputs, outputs=outputs, api_name="generate_mesh")
|
| 40 |
|
|
|
|
| 1 |
from diffusers import StableDiffusionPipeline, DiffusionPipeline
|
| 2 |
import torch
|
| 3 |
import gradio as gr
|
| 4 |
+
|
| 5 |
import spaces
|
| 6 |
|
| 7 |
css = """
|
| 8 |
#img-display-output {
|
| 9 |
+
max-height: 60vh;
|
| 10 |
}
|
| 11 |
|
| 12 |
#img-display-output *{
|
| 13 |
+
max-height: 60vh;
|
| 14 |
}
|
| 15 |
"""
|
| 16 |
|
|
|
|
| 23 |
@spaces.GPU(enable_queue=True)
|
| 24 |
def generate_sprite(prompt):
|
| 25 |
# pipe = pipe.to(DEVICE)
|
| 26 |
+
# image = pipe(prompt).images[0]
|
| 27 |
+
images = pipe(prompt).images
|
| 28 |
+
return images
|
| 29 |
|
| 30 |
title = "# SD_PixelArt_SpriteSheet_Generator"
|
| 31 |
description = """Pixel Art Sprite Sheet Generator with Stable Diffusion Checkpoint."""
|
|
|
|
| 36 |
|
| 37 |
with gr.Column():
|
| 38 |
inputs=gr.TextArea(label="Prompt", placeholder="Prompt")
|
| 39 |
+
# outputs=gr.Image(label="Ouput Image", type='pil', elem_id="img-display-output")
|
| 40 |
+
outputs=gr.Gallery(label="Ouput Images", columns=4, elem_id="img-display-output")
|
| 41 |
generate_btn = gr.Button(value="Generate")
|
| 42 |
generate_btn.click(generate_sprite, inputs=inputs, outputs=outputs, api_name="generate_mesh")
|
| 43 |
|