Spaces:
Running
on
Zero
Running
on
Zero
fix: enhance save_image function with type hint and debug prints
Browse files
debug.py
CHANGED
|
@@ -28,8 +28,10 @@ scheduler = CommitScheduler(
|
|
| 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:
|
|
@@ -55,8 +57,8 @@ def log_params(
|
|
| 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:
|
|
|
|
| 28 |
|
| 29 |
)
|
| 30 |
|
| 31 |
+
def save_image(image_id, image_path: Image.Image) -> None:
|
| 32 |
os.makedirs(IMAGE_DIR, exist_ok=True)
|
| 33 |
+
print("Image ID: " + image_id)
|
| 34 |
+
print("Image ID Type: " + str(type(image_id)))
|
| 35 |
save_image_path = os.path.join(IMAGE_DIR, f"{image_id}.png")
|
| 36 |
with scheduler.lock:
|
| 37 |
try:
|
|
|
|
| 57 |
print("Type after: " + str(type(after_image)))
|
| 58 |
save_image(before_id, before_image)
|
| 59 |
save_image(after_id, after_image)
|
| 60 |
+
#print("Before path: " + before_path)
|
| 61 |
+
#print("After path: " + after_path)
|
| 62 |
|
| 63 |
is_new = not os.path.exists(LOG_FILE)
|
| 64 |
with open(LOG_FILE, "a", newline='') as f:
|