LPX55 commited on
Commit
ea5a4a5
·
verified ·
1 Parent(s): ba738f8

Update debug.py

Browse files
Files changed (1) hide show
  1. debug.py +15 -19
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
- 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,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
- try:
56
- img2 = Image.open(cache_file)
57
- img2.save(save_image_path)
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