Spaces:
Runtime error
Runtime error
Update app.py
Browse files• added [herge-style](https://huggingface.co/sd-dreambooth-library/herge-style)
• fixed image resize
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
from email import generator
|
2 |
from diffusers import StableDiffusionPipeline
|
3 |
from diffusers import StableDiffusionImg2ImgPipeline
|
4 |
import gradio as gr
|
@@ -14,9 +13,9 @@ models = [
|
|
14 |
"lambdalabs/sd-pokemon-diffusers",
|
15 |
"yuk/fuyuko-waifu-diffusion",
|
16 |
"AstraliteHeart/pony-diffusion",
|
17 |
-
"IfanSnek/JohnDiffusion",
|
18 |
"nousr/robo-diffusion",
|
19 |
-
"DGSpitzer/Cyberpunk-Anime-Diffusion"
|
|
|
20 |
]
|
21 |
|
22 |
prompt_prefixes = {
|
@@ -30,8 +29,8 @@ prompt_prefixes = {
|
|
30 |
models[7]: "",
|
31 |
models[8]: "",
|
32 |
models[9]: "",
|
33 |
-
models[10]: "",
|
34 |
-
models[11]: "
|
35 |
}
|
36 |
|
37 |
current_model = models[0]
|
@@ -83,7 +82,8 @@ def img_inference(model, prompt, img, strength, guidance, steps, generator):
|
|
83 |
pipe = pipe.to("cuda")
|
84 |
|
85 |
prompt = prompt_prefixes[current_model] + prompt
|
86 |
-
img.
|
|
|
87 |
image = pipe(
|
88 |
prompt,
|
89 |
init_image=img,
|
@@ -131,7 +131,7 @@ with gr.Blocks(css=css) as demo:
|
|
131 |
</div>
|
132 |
<p>
|
133 |
Demo for multiple fine-tuned Stable Diffusion models, trained on different styles: <br>
|
134 |
-
<a href="https://huggingface.co/nitrosocke/Arcane-Diffusion">Arcane</a>, <a href="https://huggingface.co/nitrosocke/archer-diffusion">Archer</a>, <a href="https://huggingface.co/nitrosocke/elden-ring-diffusion">Elden Ring</a>, <a href="https://huggingface.co/nitrosocke/spider-verse-diffusion">Spiderverse</a>, <a href="https://huggingface.co/nitrosocke/modern-disney-diffusion">Modern Disney</a>, <a href="https://huggingface.co/hakurei/waifu-diffusion">Waifu</a>, <a href="https://huggingface.co/lambdalabs/sd-pokemon-diffusers">Pokemon</a>, <a href="https://huggingface.co/yuk/fuyuko-waifu-diffusion">Fuyuko Waifu</a>, <a href="https://huggingface.co/AstraliteHeart/pony-diffusion">Pony</a>, <a href="https://huggingface.co/
|
135 |
</p>
|
136 |
</div>
|
137 |
"""
|
@@ -144,7 +144,7 @@ with gr.Blocks(css=css) as demo:
|
|
144 |
prompt = gr.Textbox(label="Prompt", placeholder="Style prefix is applied automatically")
|
145 |
with gr.Accordion("Image to image (optional)", open=False):
|
146 |
image = gr.Image(label="Image", height=256, tool="editor", type="pil")
|
147 |
-
strength = gr.Slider(label="
|
148 |
|
149 |
with gr.Accordion("Advanced options", open=False):
|
150 |
guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
|
|
|
|
|
1 |
from diffusers import StableDiffusionPipeline
|
2 |
from diffusers import StableDiffusionImg2ImgPipeline
|
3 |
import gradio as gr
|
|
|
13 |
"lambdalabs/sd-pokemon-diffusers",
|
14 |
"yuk/fuyuko-waifu-diffusion",
|
15 |
"AstraliteHeart/pony-diffusion",
|
|
|
16 |
"nousr/robo-diffusion",
|
17 |
+
"DGSpitzer/Cyberpunk-Anime-Diffusion",
|
18 |
+
"sd-dreambooth-library/herge-style"
|
19 |
]
|
20 |
|
21 |
prompt_prefixes = {
|
|
|
29 |
models[7]: "",
|
30 |
models[8]: "",
|
31 |
models[9]: "",
|
32 |
+
models[10]: "dgs illustration style ",
|
33 |
+
models[11]: "herge_style ",
|
34 |
}
|
35 |
|
36 |
current_model = models[0]
|
|
|
82 |
pipe = pipe.to("cuda")
|
83 |
|
84 |
prompt = prompt_prefixes[current_model] + prompt
|
85 |
+
ratio = min(512 / img.height, 512 / img.width)
|
86 |
+
img = img.resize((int(img.width * ratio), int(img.height * ratio)))
|
87 |
image = pipe(
|
88 |
prompt,
|
89 |
init_image=img,
|
|
|
131 |
</div>
|
132 |
<p>
|
133 |
Demo for multiple fine-tuned Stable Diffusion models, trained on different styles: <br>
|
134 |
+
<a href="https://huggingface.co/nitrosocke/Arcane-Diffusion">Arcane</a>, <a href="https://huggingface.co/nitrosocke/archer-diffusion">Archer</a>, <a href="https://huggingface.co/nitrosocke/elden-ring-diffusion">Elden Ring</a>, <a href="https://huggingface.co/nitrosocke/spider-verse-diffusion">Spiderverse</a>, <a href="https://huggingface.co/nitrosocke/modern-disney-diffusion">Modern Disney</a>, <a href="https://huggingface.co/hakurei/waifu-diffusion">Waifu</a>, <a href="https://huggingface.co/lambdalabs/sd-pokemon-diffusers">Pokemon</a>, <a href="https://huggingface.co/yuk/fuyuko-waifu-diffusion">Fuyuko Waifu</a>, <a href="https://huggingface.co/AstraliteHeart/pony-diffusion">Pony</a>, <a href="https://huggingface.co/sd-dreambooth-library/herge-style">Hergé (Tintin)</a>, <a href="https://huggingface.co/nousr/robo-diffusion">Robo</a>, <a href="https://huggingface.co/DGSpitzer/Cyberpunk-Anime-Diffusion">Cyberpunk Anime</a>
|
135 |
</p>
|
136 |
</div>
|
137 |
"""
|
|
|
144 |
prompt = gr.Textbox(label="Prompt", placeholder="Style prefix is applied automatically")
|
145 |
with gr.Accordion("Image to image (optional)", open=False):
|
146 |
image = gr.Image(label="Image", height=256, tool="editor", type="pil")
|
147 |
+
strength = gr.Slider(label="Transformation strength", minimum=0, maximum=1, step=0.01, value=0.5)
|
148 |
|
149 |
with gr.Accordion("Advanced options", open=False):
|
150 |
guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
|