Spaces:
Running
on
Zero
Running
on
Zero
Update debug.py
Browse files
debug.py
CHANGED
|
@@ -27,15 +27,15 @@ scheduler = CommitScheduler(
|
|
| 27 |
path_in_repo="v" + APP_VERSION
|
| 28 |
)
|
| 29 |
|
| 30 |
-
def cache_temp(img_id):
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
def save_image(image_id, image_path: Image.Image) -> None:
|
| 40 |
os.makedirs(IMAGE_DIR, exist_ok=True)
|
| 41 |
print("Image ID: " + image_id)
|
|
@@ -49,17 +49,13 @@ def save_image(image_id, image_path: Image.Image) -> None:
|
|
| 49 |
print("Loaded Type: " + str(type(loaded)))
|
| 50 |
with scheduler.lock:
|
| 51 |
try:
|
| 52 |
-
cache_temp(cache_file)
|
| 53 |
-
print("Cache path: " + cache_file)
|
| 54 |
-
print("Type: " + str(type(cache_file)))
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
print(f"Saved image: {save_image_path}")
|
| 60 |
-
except Exception as e:
|
| 61 |
-
print(f"Error saving image: {str(e)}")
|
| 62 |
-
|
| 63 |
except Exception as e:
|
| 64 |
print(f"Error saving image: {str(e)}")
|
| 65 |
|
|
|
|
| 27 |
path_in_repo="v" + APP_VERSION
|
| 28 |
)
|
| 29 |
|
| 30 |
+
# def cache_temp(img_id):
|
| 31 |
+
# api.upload_file(
|
| 32 |
+
# path_or_fileobj=os.path.join("/tmp/gradio", f"{img_id}"),
|
| 33 |
|
| 34 |
+
# path_in_repo="/v" + APP_VERSION + "/" + img_id,
|
| 35 |
+
# repo_id=HF_DATASET_REPO,
|
| 36 |
+
# repo_type="dataset",
|
| 37 |
+
# token=HF_TOKEN,
|
| 38 |
+
# )
|
| 39 |
def save_image(image_id, image_path: Image.Image) -> None:
|
| 40 |
os.makedirs(IMAGE_DIR, exist_ok=True)
|
| 41 |
print("Image ID: " + image_id)
|
|
|
|
| 49 |
print("Loaded Type: " + str(type(loaded)))
|
| 50 |
with scheduler.lock:
|
| 51 |
try:
|
| 52 |
+
# cache_temp(cache_file)
|
| 53 |
+
#print("Cache path: " + cache_file)
|
| 54 |
+
#print("Type: " + str(type(cache_file)))
|
| 55 |
+
img2 = Image.open(cache_file)
|
| 56 |
+
img2.save(save_image_path)
|
| 57 |
+
|
| 58 |
+
print(f"Saved image: {save_image_path}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
except Exception as e:
|
| 60 |
print(f"Error saving image: {str(e)}")
|
| 61 |
|