Huiwenshi commited on
Commit
188b059
1 Parent(s): 3a05849

Upload ./app_hg.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app_hg.py +3 -6
app_hg.py CHANGED
@@ -194,14 +194,11 @@ if BAKE_AVAILEBLE:
194
  def gen_save_folder(max_size=30):
195
  os.makedirs('./outputs/app_output', exist_ok=True)
196
  exists = set(int(_) for _ in os.listdir('./outputs/app_output') if not _.startswith("."))
197
- if len(exists) == max_size:
198
- shutil.rmtree(f"./outputs/app_output/0")
199
- cur_id = 0
200
- else:
201
- cur_id = min(set(range(max_size)) - exists)
202
  if os.path.exists(f"./outputs/app_output/{(cur_id + 1) % max_size}"):
203
  shutil.rmtree(f"./outputs/app_output/{(cur_id + 1) % max_size}")
204
- save_folder = f'./outputs/app_output/{cur_id}'
 
205
  os.makedirs(save_folder, exist_ok=True)
206
  print(f"mkdir {save_folder} suceess !!!")
207
  return save_folder
 
194
  def gen_save_folder(max_size=30):
195
  os.makedirs('./outputs/app_output', exist_ok=True)
196
  exists = set(int(_) for _ in os.listdir('./outputs/app_output') if not _.startswith("."))
197
+ cur_id = min(set(range(max_size)) - exists) if len(exists)<max_size else -1
 
 
 
 
198
  if os.path.exists(f"./outputs/app_output/{(cur_id + 1) % max_size}"):
199
  shutil.rmtree(f"./outputs/app_output/{(cur_id + 1) % max_size}")
200
+ print(f"remove ./outputs/app_output/{(cur_id + 1) % max_size} success !!!")
201
+ save_folder = f'./outputs/app_output/{max(0, cur_id)}'
202
  os.makedirs(save_folder, exist_ok=True)
203
  print(f"mkdir {save_folder} suceess !!!")
204
  return save_folder