Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,6 @@ from torch.nn import functional as F
|
|
13 |
from torchvision import transforms
|
14 |
from torchvision.transforms import functional as TF
|
15 |
from tqdm import trange
|
16 |
-
from CLIP import clip
|
17 |
from cloob_training import model_pt, pretrained
|
18 |
import ldm.models.autoencoder
|
19 |
from diffusion import sampling, utils
|
@@ -115,8 +114,8 @@ def generate(n=1, prompts=['a red circle'], images=[], seed=42, steps=15, method
|
|
115 |
n_conds = len(target_embeds)
|
116 |
x_in = x.repeat([n_conds, 1, 1, 1])
|
117 |
t_in = t.repeat([n_conds])
|
118 |
-
|
119 |
-
vs = model(x_in, t_in,
|
120 |
v = vs.mul(weights[:, None, None, None, None]).sum(0)
|
121 |
return v
|
122 |
|
@@ -192,32 +191,31 @@ iface = gr.Interface(
|
|
192 |
["self-portrait"],
|
193 |
["Impressionism, oil on canvas"],
|
194 |
["Katsushika Hokusai, The Dragon of Smoke Escaping from Mount Fuji"],
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
],
|
221 |
title='Art Generator and Style Mixer from 🧠 Cloob and 🎨 WikiArt - Visual Art Encyclopedia',
|
222 |
description="Trained on images from the [WikiArt](https://www.wikiart.org/) dataset, comprised of visual arts",
|
223 |
article='Model used is: [model card](https://huggingface.co/huggan/distill-ccld-wa).'
|
|
|
13 |
from torchvision import transforms
|
14 |
from torchvision.transforms import functional as TF
|
15 |
from tqdm import trange
|
|
|
16 |
from cloob_training import model_pt, pretrained
|
17 |
import ldm.models.autoencoder
|
18 |
from diffusion import sampling, utils
|
|
|
114 |
n_conds = len(target_embeds)
|
115 |
x_in = x.repeat([n_conds, 1, 1, 1])
|
116 |
t_in = t.repeat([n_conds])
|
117 |
+
embed_in = torch.cat([*target_embeds]).repeat_interleave(n, 0)
|
118 |
+
vs = model(x_in, t_in, embed_in).view([n_conds, n, *x.shape[1:]])
|
119 |
v = vs.mul(weights[:, None, None, None, None]).sum(0)
|
120 |
return v
|
121 |
|
|
|
191 |
["self-portrait"],
|
192 |
["Impressionism, oil on canvas"],
|
193 |
["Katsushika Hokusai, The Dragon of Smoke Escaping from Mount Fuji"],
|
194 |
+
["Moon Light Sonata by Basuki Abdullah"],
|
195 |
+
["Two Trees by M.C. Escher"],
|
196 |
+
["Futurism, in the style of Wassily Kandinsky"],
|
197 |
+
["Surrealism, in the style of Edgar Degas"],
|
198 |
+
["Expressionism, in the style of Wassily Kandinsky"],
|
199 |
+
["Futurism, in the style of Egon Schiele"],
|
200 |
+
["Cubism, in the style of Gustav Klimt"],
|
201 |
+
["Op Art, in the style of Marc Chagall"],
|
202 |
+
["Romanticism, in the style of M.C. Escher"],
|
203 |
+
["Futurism, in the style of M.C. Escher"],
|
204 |
+
["Mannerism, in the style of Paul Klee"],
|
205 |
+
["High Renaissance, in the style of Rembrandt"],
|
206 |
+
["Magic Realism, in the style of Gustave Dore"],
|
207 |
+
["Realism, in the style of Jean-Michel Basquiat"],
|
208 |
+
["Art Nouveau, in the style of Paul Gauguin"],
|
209 |
+
["Avant-garde, in the style of Pierre-Auguste Renoir"],
|
210 |
+
["Baroque, in the style of Edward Hopper"],
|
211 |
+
["Post-Impressionism, in the style of Wassily Kandinsky"],
|
212 |
+
["Naturalism, in the style of Rene Magritte"],
|
213 |
+
["Constructivism, in the style of Paul Cezanne"],
|
214 |
+
["Abstract Expressionism, in the style of Henri Matisse"],
|
215 |
+
["Pop Art, in the style of Vincent van Gogh"],
|
216 |
+
["Futurism, in the style of Zdzislaw Beksinski"],
|
217 |
+
["Aaron Wacker, oil on canvas"]
|
218 |
+
],
|
|
|
219 |
title='Art Generator and Style Mixer from 🧠 Cloob and 🎨 WikiArt - Visual Art Encyclopedia',
|
220 |
description="Trained on images from the [WikiArt](https://www.wikiart.org/) dataset, comprised of visual arts",
|
221 |
article='Model used is: [model card](https://huggingface.co/huggan/distill-ccld-wa).'
|