Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import base64
|
2 |
from io import BytesIO
|
3 |
|
@@ -8,8 +9,8 @@ import torch
|
|
8 |
from diffusers import StableDiffusionPipeline, AutoencoderKL, AutoencoderTiny
|
9 |
from peft import PeftModel
|
10 |
|
11 |
-
device = "
|
12 |
-
weight_type = torch.
|
13 |
|
14 |
pipe = StableDiffusionPipeline.from_pretrained("IDKiro/sdxs-512-dreamshaper", torch_dtype=weight_type)
|
15 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, "IDKiro/sdxs-512-dreamshaper-anime")
|
@@ -28,6 +29,7 @@ def pil_image_to_data_url(img, format="PNG"):
|
|
28 |
return f"data:image/{format.lower()};base64,{img_str}"
|
29 |
|
30 |
|
|
|
31 |
def run(
|
32 |
prompt: str,
|
33 |
device_type="GPU",
|
@@ -64,7 +66,8 @@ examples = [
|
|
64 |
]
|
65 |
|
66 |
with gr.Blocks(css="style.css") as demo:
|
67 |
-
gr.Markdown("# SDXS-512-DreamShaper-Anime
|
|
|
68 |
with gr.Group():
|
69 |
with gr.Row():
|
70 |
with gr.Column(min_width=685):
|
@@ -80,9 +83,9 @@ with gr.Blocks(css="style.css") as demo:
|
|
80 |
|
81 |
device_choices = ['GPU','CPU']
|
82 |
device_type = gr.Radio(device_choices, label='Device',
|
83 |
-
value=device_choices[
|
84 |
-
interactive=
|
85 |
-
info='
|
86 |
|
87 |
vae_choices = ['tiny vae','large vae']
|
88 |
vae_type = gr.Radio(vae_choices, label='Image Decoder Type',
|
|
|
1 |
+
import space
|
2 |
import base64
|
3 |
from io import BytesIO
|
4 |
|
|
|
9 |
from diffusers import StableDiffusionPipeline, AutoencoderKL, AutoencoderTiny
|
10 |
from peft import PeftModel
|
11 |
|
12 |
+
device = "cuda"
|
13 |
+
weight_type = torch.float16
|
14 |
|
15 |
pipe = StableDiffusionPipeline.from_pretrained("IDKiro/sdxs-512-dreamshaper", torch_dtype=weight_type)
|
16 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, "IDKiro/sdxs-512-dreamshaper-anime")
|
|
|
29 |
return f"data:image/{format.lower()};base64,{img_str}"
|
30 |
|
31 |
|
32 |
+
@spaces.GPU
|
33 |
def run(
|
34 |
prompt: str,
|
35 |
device_type="GPU",
|
|
|
66 |
]
|
67 |
|
68 |
with gr.Blocks(css="style.css") as demo:
|
69 |
+
gr.Markdown("# SDXS-512-DreamShaper-Anime")
|
70 |
+
gr.Markdown("[SDXS: Real-Time One-Step Latent Diffusion Models with Image Conditions](https://arxiv.org/abs/2403.16627) | [GitHub](https://github.com/IDKiro/sdxs")
|
71 |
with gr.Group():
|
72 |
with gr.Row():
|
73 |
with gr.Column(min_width=685):
|
|
|
83 |
|
84 |
device_choices = ['GPU','CPU']
|
85 |
device_type = gr.Radio(device_choices, label='Device',
|
86 |
+
value=device_choices[0],
|
87 |
+
interactive=True,
|
88 |
+
info='Thanks to the community for the GPU!')
|
89 |
|
90 |
vae_choices = ['tiny vae','large vae']
|
91 |
vae_type = gr.Radio(vae_choices, label='Image Decoder Type',
|