Spaces:
Running
on
Zero
Running
on
Zero
fix dev mode plz
Browse files
debug.py
CHANGED
@@ -27,13 +27,18 @@ scheduler = CommitScheduler(
|
|
27 |
path_in_repo="v" + APP_VERSION
|
28 |
|
29 |
)
|
30 |
-
|
|
|
31 |
os.makedirs(IMAGE_DIR, exist_ok=True)
|
32 |
-
|
33 |
with scheduler.lock:
|
34 |
try:
|
35 |
-
Image
|
36 |
-
print(
|
|
|
|
|
|
|
|
|
37 |
except Exception as e:
|
38 |
print(f"Error saving image: {str(e)}")
|
39 |
|
@@ -43,10 +48,15 @@ def log_params(
|
|
43 |
):
|
44 |
before_id = str(uuid.uuid4()) + "_before.png"
|
45 |
after_id = str(uuid.uuid4()) + "_after.png"
|
|
|
46 |
before_path = os.path.join(IMAGE_DIR, before_id)
|
47 |
after_path = os.path.join(IMAGE_DIR, after_id)
|
|
|
|
|
48 |
save_image(before_id, before_image)
|
49 |
save_image(after_id, after_image)
|
|
|
|
|
50 |
|
51 |
is_new = not os.path.exists(LOG_FILE)
|
52 |
with open(LOG_FILE, "a", newline='') as f:
|
|
|
27 |
path_in_repo="v" + APP_VERSION
|
28 |
|
29 |
)
|
30 |
+
|
31 |
+
def save_image(image_id, image_path) -> None:
|
32 |
os.makedirs(IMAGE_DIR, exist_ok=True)
|
33 |
+
save_image_path = os.path.join(IMAGE_DIR, f"{image_id}.png")
|
34 |
with scheduler.lock:
|
35 |
try:
|
36 |
+
print("Image path: " + image_path)
|
37 |
+
print("Type: " + str(type(image_path)))
|
38 |
+
commit_image = Image.open(image_path)
|
39 |
+
commit_image = commit_image.convert("P", palette=Image.ADAPTIVE, colors=256)
|
40 |
+
commit_image.save(save_image_path)
|
41 |
+
print(f"Saved image: {save_image_path}")
|
42 |
except Exception as e:
|
43 |
print(f"Error saving image: {str(e)}")
|
44 |
|
|
|
48 |
):
|
49 |
before_id = str(uuid.uuid4()) + "_before.png"
|
50 |
after_id = str(uuid.uuid4()) + "_after.png"
|
51 |
+
|
52 |
before_path = os.path.join(IMAGE_DIR, before_id)
|
53 |
after_path = os.path.join(IMAGE_DIR, after_id)
|
54 |
+
print("Type before: " + str(type(before_image)))
|
55 |
+
print("Type after: " + str(type(after_image)))
|
56 |
save_image(before_id, before_image)
|
57 |
save_image(after_id, after_image)
|
58 |
+
print("Before path: " + before_path)
|
59 |
+
print("After path: " + after_path)
|
60 |
|
61 |
is_new = not os.path.exists(LOG_FILE)
|
62 |
with open(LOG_FILE, "a", newline='') as f:
|