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

Update debug.py

Browse files
Files changed (1) hide show
  1. debug.py +8 -6
debug.py CHANGED
@@ -29,7 +29,7 @@ scheduler = CommitScheduler(
29
 
30
  def cache_temp(img_id):
31
  api.upload_file(
32
- path_or_fileobj=os.path.join("/tmp/logs_0_4/upscaler", f"{img_id}"),
33
 
34
  path_in_repo="/v" + APP_VERSION + "/" + img_id,
35
  repo_id=HF_DATASET_REPO,
@@ -44,15 +44,17 @@ def save_image(image_id, image_path: Image.Image) -> None:
44
  print("Save image path: " + save_image_path)
45
  try:
46
  loaded = load_image(image_path)
 
 
47
  print("Loaded Type: " + str(type(loaded)))
48
  with scheduler.lock:
49
  try:
50
- cache_temp(save_image_path)
51
- # print("Image path: " + image_path)
52
- print("Type: " + str(type(image_path)))
53
  try:
54
- # img2 = img2.open(img)
55
- loaded.save(save_image_path)
56
 
57
  print(f"Saved image: {save_image_path}")
58
  except Exception as e:
 
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,
 
44
  print("Save image path: " + save_image_path)
45
  try:
46
  loaded = load_image(image_path)
47
+ cache_file = "/tmp/gradio/" + str(uuid.uuid4()) + ".png"
48
+ loaded.save(cache_file, "PNG")
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: