Spaces:
Configuration error
Configuration error
img history
Browse files- ImageState.py +2 -1
- animation.py +2 -1
ImageState.py
CHANGED
|
@@ -124,8 +124,9 @@ class ImageState:
|
|
| 124 |
new_latent, _, _ = self.vqgan.quantize(new_latent.to(self.device))
|
| 125 |
image = self._decode_latent_to_pil(new_latent)
|
| 126 |
img_dir = self.state_id
|
| 127 |
-
if not os.path.exists(
|
| 128 |
os.mkdir("./img_history")
|
|
|
|
| 129 |
os.mkdir(img_dir)
|
| 130 |
image.save(f"{img_dir}/img_{num:06}.png")
|
| 131 |
num += 1
|
|
|
|
| 124 |
new_latent, _, _ = self.vqgan.quantize(new_latent.to(self.device))
|
| 125 |
image = self._decode_latent_to_pil(new_latent)
|
| 126 |
img_dir = self.state_id
|
| 127 |
+
if not os.path.exists("img_history"):
|
| 128 |
os.mkdir("./img_history")
|
| 129 |
+
if not os.path.exists(img_dir):
|
| 130 |
os.mkdir(img_dir)
|
| 131 |
image.save(f"{img_dir}/img_{num:06}.png")
|
| 132 |
num += 1
|
animation.py
CHANGED
|
@@ -3,8 +3,9 @@ import glob
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
def clear_img_dir(img_dir):
|
| 6 |
-
if not os.path.exists(
|
| 7 |
os.mkdir("img_history")
|
|
|
|
| 8 |
os.mkdir(img_dir)
|
| 9 |
for filename in glob.glob(img_dir+"/*"):
|
| 10 |
os.remove(filename)
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
def clear_img_dir(img_dir):
|
| 6 |
+
if not os.path.exists("img_history"):
|
| 7 |
os.mkdir("img_history")
|
| 8 |
+
if not os.path.exists(img_dir):
|
| 9 |
os.mkdir(img_dir)
|
| 10 |
for filename in glob.glob(img_dir+"/*"):
|
| 11 |
os.remove(filename)
|