LPX55 commited on
Commit
a592742
·
verified ·
1 Parent(s): a87bfa9

Update debug.py

Browse files
Files changed (1) hide show
  1. debug.py +11 -3
debug.py CHANGED
@@ -16,8 +16,7 @@ LOG_DIR = "logs_" + APP_VERSION
16
  IMAGE_DIR = os.path.join(LOG_DIR, "upscaler")
17
 
18
  LOG_FILE = os.path.join(LOG_DIR, f"{int(time.time())}-logs.csv")
19
-
20
-
21
  scheduler = CommitScheduler(
22
  repo_id=HF_DATASET_REPO,
23
  repo_type="dataset",
@@ -26,9 +25,17 @@ scheduler = CommitScheduler(
26
  private=True,
27
  token=HF_TOKEN,
28
  path_in_repo="v" + APP_VERSION
29
-
30
  )
31
 
 
 
 
 
 
 
 
 
 
32
  def save_image(image_id, image_path: Image.Image) -> None:
33
  os.makedirs(IMAGE_DIR, exist_ok=True)
34
  print("Image ID: " + image_id)
@@ -42,6 +49,7 @@ def save_image(image_id, image_path: Image.Image) -> None:
42
  print(f"Error loading image: {str(e)}")
43
  with scheduler.lock:
44
  try:
 
45
  # print("Image path: " + image_path)
46
  print("Type: " + str(type(image_path)))
47
  with load_image(image_path) as img:
 
16
  IMAGE_DIR = os.path.join(LOG_DIR, "upscaler")
17
 
18
  LOG_FILE = os.path.join(LOG_DIR, f"{int(time.time())}-logs.csv")
19
+ api = HfApi(token=HF_TOKEN)
 
20
  scheduler = CommitScheduler(
21
  repo_id=HF_DATASET_REPO,
22
  repo_type="dataset",
 
25
  private=True,
26
  token=HF_TOKEN,
27
  path_in_repo="v" + APP_VERSION
 
28
  )
29
 
30
+ def cache_temp(img_id):
31
+ api.upload_file(
32
+ path_or_fileobj="/path/to/local/folder/README.md",
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(f"Error loading image: {str(e)}")
50
  with scheduler.lock:
51
  try:
52
+ cache_temp(save_image_path)
53
  # print("Image path: " + image_path)
54
  print("Type: " + str(type(image_path)))
55
  with load_image(image_path) as img: