Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://huggingface.co/spaces/lambdalabs/text-to-naruto into main
Browse files- app.py +14 -14
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -9,11 +9,11 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
| 9 |
context = autocast if device == "cuda" else nullcontext
|
| 10 |
dtype = torch.float16 if device == "cuda" else torch.float32
|
| 11 |
|
| 12 |
-
pipe = StableDiffusionPipeline.from_pretrained("lambdalabs/sd-
|
| 13 |
pipe = pipe.to(device)
|
| 14 |
|
| 15 |
|
| 16 |
-
# Sometimes the nsfw checker is confused by the
|
| 17 |
# it at your own risk here
|
| 18 |
disable_safety = True
|
| 19 |
|
|
@@ -115,35 +115,35 @@ block = gr.Blocks(css=css)
|
|
| 115 |
|
| 116 |
examples = [
|
| 117 |
[
|
| 118 |
-
'
|
| 119 |
2,
|
| 120 |
7.5,
|
| 121 |
],
|
| 122 |
[
|
| 123 |
-
'
|
| 124 |
2,
|
| 125 |
7.5,
|
| 126 |
],
|
| 127 |
[
|
| 128 |
-
'
|
| 129 |
2,
|
| 130 |
-
7
|
| 131 |
],
|
| 132 |
]
|
| 133 |
|
| 134 |
with block:
|
| 135 |
gr.HTML(
|
| 136 |
"""
|
| 137 |
-
<div style="text-align: center; max-width: 650px; margin:
|
| 138 |
<div>
|
| 139 |
<img class="logo" src="https://lambdalabs.com/static/images/lambda-logo.svg" alt="Lambda Logo"
|
| 140 |
-
style="margin:
|
| 141 |
-
<h1 style="font-weight: 900; font-size: 3rem;">
|
| 142 |
-
|
| 143 |
</h1>
|
| 144 |
</div>
|
| 145 |
-
<p style="margin-bottom: 10px; font-size: 94
|
| 146 |
-
Generate new
|
| 147 |
<a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">created by Lambda Labs</a>.
|
| 148 |
</p>
|
| 149 |
</div>
|
|
@@ -193,10 +193,10 @@ with block:
|
|
| 193 |
</p>
|
| 194 |
</div>
|
| 195 |
<div class="acknowledgments">
|
| 196 |
-
<p> Put in a text prompt and generate your own
|
| 197 |
<p>If you want to find out how we made this model read about it in <a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">this blog post</a>.
|
| 198 |
<p>And if you want to train your own Stable Diffusion variants, see our <a href="https://github.com/LambdaLabsML/examples/tree/main/stable-diffusion-finetuning">Examples Repo</a>!
|
| 199 |
-
<p>Trained by
|
| 200 |
</div>
|
| 201 |
"""
|
| 202 |
)
|
|
|
|
| 9 |
context = autocast if device == "cuda" else nullcontext
|
| 10 |
dtype = torch.float16 if device == "cuda" else torch.float32
|
| 11 |
|
| 12 |
+
pipe = StableDiffusionPipeline.from_pretrained("lambdalabs/sd-pokemon-diffusers", torch_dtype=dtype)
|
| 13 |
pipe = pipe.to(device)
|
| 14 |
|
| 15 |
|
| 16 |
+
# Sometimes the nsfw checker is confused by the Pokémon images, you can disable
|
| 17 |
# it at your own risk here
|
| 18 |
disable_safety = True
|
| 19 |
|
|
|
|
| 115 |
|
| 116 |
examples = [
|
| 117 |
[
|
| 118 |
+
'Yoda',
|
| 119 |
2,
|
| 120 |
7.5,
|
| 121 |
],
|
| 122 |
[
|
| 123 |
+
'Abraham Lincoln',
|
| 124 |
2,
|
| 125 |
7.5,
|
| 126 |
],
|
| 127 |
[
|
| 128 |
+
'George Washington',
|
| 129 |
2,
|
| 130 |
+
7,
|
| 131 |
],
|
| 132 |
]
|
| 133 |
|
| 134 |
with block:
|
| 135 |
gr.HTML(
|
| 136 |
"""
|
| 137 |
+
<div style="text-align: center; max-width: 650px; margin: 30;">
|
| 138 |
<div>
|
| 139 |
<img class="logo" src="https://lambdalabs.com/static/images/lambda-logo.svg" alt="Lambda Logo"
|
| 140 |
+
style="margin: 30; max-width: 7rem;">
|
| 141 |
+
<h1 style="font-weight: 900; font-size: 3rem; margin: 30;">
|
| 142 |
+
Pokémon text to image
|
| 143 |
</h1>
|
| 144 |
</div>
|
| 145 |
+
<p style="margin-bottom: 10px; font-size: 94%; margin: 30">
|
| 146 |
+
Generate new Pokémon from a text description,
|
| 147 |
<a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">created by Lambda Labs</a>.
|
| 148 |
</p>
|
| 149 |
</div>
|
|
|
|
| 193 |
</p>
|
| 194 |
</div>
|
| 195 |
<div class="acknowledgments">
|
| 196 |
+
<p> Put in a text prompt and generate your own Pokémon character, no "prompt engineering" required!
|
| 197 |
<p>If you want to find out how we made this model read about it in <a href="https://lambdalabs.com/blog/how-to-fine-tune-stable-diffusion-how-we-made-the-text-to-pokemon-model-at-lambda/">this blog post</a>.
|
| 198 |
<p>And if you want to train your own Stable Diffusion variants, see our <a href="https://github.com/LambdaLabsML/examples/tree/main/stable-diffusion-finetuning">Examples Repo</a>!
|
| 199 |
+
<p>Trained by <a href="justinpinkney.com">Justin Pinkney</a> (<a href="https://twitter.com/Buntworthy">@Buntworthy</a>) at <a href="https://lambdalabs.com/">Lambda Labs</a>.</p>
|
| 200 |
</div>
|
| 201 |
"""
|
| 202 |
)
|
requirements.txt
CHANGED
|
@@ -4,4 +4,5 @@ diffusers
|
|
| 4 |
transformers
|
| 5 |
scipy
|
| 6 |
ftfy
|
| 7 |
-
datasets
|
|
|
|
|
|
| 4 |
transformers
|
| 5 |
scipy
|
| 6 |
ftfy
|
| 7 |
+
datasets
|
| 8 |
+
gradio==3.5
|