Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ if torch.cuda.is_available():
|
|
37 |
|
38 |
device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
39 |
|
40 |
-
def
|
41 |
|
42 |
global current_model
|
43 |
global pipe
|
@@ -47,13 +47,18 @@ def on_model_change(model):
|
|
47 |
if torch.cuda.is_available():
|
48 |
pipe = pipe.to("cuda")
|
49 |
|
50 |
-
def inference(prompt, guidance, steps):
|
51 |
-
|
52 |
prompt = prompt_prefixes[current_model] + prompt
|
53 |
image = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images[0]
|
54 |
return image
|
55 |
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
gr.HTML(
|
58 |
"""
|
59 |
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
@@ -70,7 +75,7 @@ with gr.Blocks() as demo:
|
|
70 |
</h1>
|
71 |
</div>
|
72 |
<p style="margin-bottom: 10px; font-size: 94%">
|
73 |
-
Demo for multiple fine-tuned Stable Diffusion models, trained on different styles:
|
74 |
<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/IfanSnek/JohnDiffusion">John</a>, <a href="https://huggingface.co/nousr/robo-diffusion">Robo</a>.
|
75 |
</p>
|
76 |
</div>
|
@@ -88,18 +93,17 @@ with gr.Blocks() as demo:
|
|
88 |
with gr.Column():
|
89 |
image_out = gr.Image(height=512)
|
90 |
|
91 |
-
|
92 |
-
run.click(inference, inputs=[prompt, guidance, steps], outputs=image_out)
|
93 |
gr.Examples([
|
94 |
-
["jason bateman disassembling the demon core", 7.5, 50],
|
95 |
-
["portrait of dwayne johnson", 7.0, 75],
|
96 |
-
["portrait of a beautiful alyx vance half life", 10, 50],
|
97 |
-
["Aloy from Horizon: Zero Dawn, half body portrait, smooth, detailed armor, beautiful face, illustration", 7, 45],
|
98 |
-
["fantasy portrait painting, digital art", 4, 30],
|
99 |
], [prompt, guidance, steps], image_out, inference, cache_examples=torch.cuda.is_available())
|
100 |
gr.HTML('''
|
101 |
<div>
|
102 |
-
<p>Model by <a href="https://huggingface.co/nitrosocke"
|
103 |
</div>
|
104 |
<div>Space by
|
105 |
<a href="https://twitter.com/hahahahohohe">
|
|
|
37 |
|
38 |
device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
39 |
|
40 |
+
def inference(model, prompt, guidance, steps):
|
41 |
|
42 |
global current_model
|
43 |
global pipe
|
|
|
47 |
if torch.cuda.is_available():
|
48 |
pipe = pipe.to("cuda")
|
49 |
|
|
|
|
|
50 |
prompt = prompt_prefixes[current_model] + prompt
|
51 |
image = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images[0]
|
52 |
return image
|
53 |
|
54 |
+
css = """
|
55 |
+
<style>
|
56 |
+
a {
|
57 |
+
text-decoration: underline;
|
58 |
+
}
|
59 |
+
</style>
|
60 |
+
"""
|
61 |
+
with gr.Blocks(css=css) as demo:
|
62 |
gr.HTML(
|
63 |
"""
|
64 |
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
|
|
75 |
</h1>
|
76 |
</div>
|
77 |
<p style="margin-bottom: 10px; font-size: 94%">
|
78 |
+
Demo for multiple fine-tuned Stable Diffusion models, trained on different styles: <br>
|
79 |
<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/IfanSnek/JohnDiffusion">John</a>, <a href="https://huggingface.co/nousr/robo-diffusion">Robo</a>.
|
80 |
</p>
|
81 |
</div>
|
|
|
93 |
with gr.Column():
|
94 |
image_out = gr.Image(height=512)
|
95 |
|
96 |
+
run.click(inference, inputs=[model, prompt, guidance, steps], outputs=image_out)
|
|
|
97 |
gr.Examples([
|
98 |
+
[models[0], "jason bateman disassembling the demon core", 7.5, 50],
|
99 |
+
[models[3], "portrait of dwayne johnson", 7.0, 75],
|
100 |
+
[models[4], "portrait of a beautiful alyx vance half life", 10, 50],
|
101 |
+
[models[5], "Aloy from Horizon: Zero Dawn, half body portrait, smooth, detailed armor, beautiful face, illustration", 7, 45],
|
102 |
+
[models[4], "fantasy portrait painting, digital art", 4, 30],
|
103 |
], [prompt, guidance, steps], image_out, inference, cache_examples=torch.cuda.is_available())
|
104 |
gr.HTML('''
|
105 |
<div>
|
106 |
+
<p>Model by <a href="https://huggingface.co/nitrosocke" target="_blank">@nitrosocke</a> ❤️</p>
|
107 |
</div>
|
108 |
<div>Space by
|
109 |
<a href="https://twitter.com/hahahahohohe">
|