Spaces:
Runtime error
Runtime error
Riccardo Giorato
commited on
Commit
•
50c4034
1
Parent(s):
247b595
fixes
Browse files- .vscode/settings.json +3 -0
- app.py +7 -7
.vscode/settings.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"editor.wordWrap": "on"
|
3 |
+
}
|
app.py
CHANGED
@@ -19,7 +19,7 @@ models = [
|
|
19 |
]
|
20 |
|
21 |
last_mode = "txt2img"
|
22 |
-
current_model = models[
|
23 |
current_model_path = current_model.path
|
24 |
|
25 |
if is_colab:
|
@@ -27,14 +27,14 @@ if is_colab:
|
|
27 |
|
28 |
else: # download all models
|
29 |
vae = AutoencoderKL.from_pretrained(current_model.path, subfolder="vae", torch_dtype=torch.float16)
|
30 |
-
for model in models[
|
31 |
try:
|
32 |
unet = UNet2DConditionModel.from_pretrained(model.path, subfolder="unet", torch_dtype=torch.float16)
|
33 |
model.pipe_t2i = StableDiffusionPipeline.from_pretrained(model.path, unet=unet, vae=vae, torch_dtype=torch.float16)
|
34 |
model.pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(model.path, unet=unet, vae=vae, torch_dtype=torch.float16)
|
35 |
except:
|
36 |
models.remove(model)
|
37 |
-
pipe = models[
|
38 |
|
39 |
if torch.cuda.is_available():
|
40 |
pipe = pipe.to("cuda")
|
@@ -171,13 +171,13 @@ with gr.Blocks(css=css) as demo:
|
|
171 |
f"""
|
172 |
<div class="finetuned-diffusion-div">
|
173 |
<div>
|
174 |
-
<h1>
|
175 |
</div>
|
176 |
<p>
|
177 |
Demo for multiple fine-tuned Stable Diffusion models, trained on different styles: <br>
|
178 |
-
<a href="
|
|
|
179 |
</p>
|
180 |
-
<p>Don't want to wait in queue? <a href="https://colab.research.google.com/gist/qunash/42112fb104509c24fd3aa6d1c11dd6e0/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://camo.githubusercontent.com/84f0493939e0c4de4e6dbe113251b4bfb5353e57134ffd9fcab6b8714514d4d1/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667"></a></p>
|
181 |
Running on <b>{device}</b>{(" in a <b>Google Colab</b>." if is_colab else "")}
|
182 |
</p>
|
183 |
</div>
|
@@ -233,7 +233,7 @@ with gr.Blocks(css=css) as demo:
|
|
233 |
generate.click(inference, inputs=inputs, outputs=image_out)
|
234 |
|
235 |
ex = gr.Examples([
|
236 |
-
[models[
|
237 |
], [model_name, prompt, guidance, steps, seed], image_out, inference, cache_examples=False)
|
238 |
|
239 |
gr.Markdown('''
|
|
|
19 |
]
|
20 |
|
21 |
last_mode = "txt2img"
|
22 |
+
current_model = models[0]
|
23 |
current_model_path = current_model.path
|
24 |
|
25 |
if is_colab:
|
|
|
27 |
|
28 |
else: # download all models
|
29 |
vae = AutoencoderKL.from_pretrained(current_model.path, subfolder="vae", torch_dtype=torch.float16)
|
30 |
+
for model in models[0:]:
|
31 |
try:
|
32 |
unet = UNet2DConditionModel.from_pretrained(model.path, subfolder="unet", torch_dtype=torch.float16)
|
33 |
model.pipe_t2i = StableDiffusionPipeline.from_pretrained(model.path, unet=unet, vae=vae, torch_dtype=torch.float16)
|
34 |
model.pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(model.path, unet=unet, vae=vae, torch_dtype=torch.float16)
|
35 |
except:
|
36 |
models.remove(model)
|
37 |
+
pipe = models[0].pipe_t2i
|
38 |
|
39 |
if torch.cuda.is_available():
|
40 |
pipe = pipe.to("cuda")
|
|
|
171 |
f"""
|
172 |
<div class="finetuned-diffusion-div">
|
173 |
<div>
|
174 |
+
<h1>Playground Diffusion</h1>
|
175 |
</div>
|
176 |
<p>
|
177 |
Demo for multiple fine-tuned Stable Diffusion models, trained on different styles: <br>
|
178 |
+
<a href="riccardogiorato/beeple-diffusion">Beeple</a>,
|
179 |
+
Diffusers 🧨 SD model hosted on HuggingFace 🤗.
|
180 |
</p>
|
|
|
181 |
Running on <b>{device}</b>{(" in a <b>Google Colab</b>." if is_colab else "")}
|
182 |
</p>
|
183 |
</div>
|
|
|
233 |
generate.click(inference, inputs=inputs, outputs=image_out)
|
234 |
|
235 |
ex = gr.Examples([
|
236 |
+
[models[0].name, "Neon techno-magic robot with spear pierces an ancient beast, hyperrealism, no blur, 4k resolution, ultra detailed", 7.5, 50],
|
237 |
], [model_name, prompt, guidance, steps, seed], image_out, inference, cache_examples=False)
|
238 |
|
239 |
gr.Markdown('''
|