kovacsvi commited on
Commit
8d3cc6e
·
1 Parent(s): 2de073f

safer approach to clean cache

Browse files
Files changed (1) hide show
  1. utils.py +6 -2
utils.py CHANGED
@@ -130,8 +130,12 @@ def delete_unused_bin_files(model_id: str):
130
  for file_path in files_to_delete:
131
  if os.path.basename(file_path) == "config.json":
132
  continue
133
- print(f"Deleting: {file_path}")
134
- os.remove(file_path)
 
 
 
 
135
 
136
 
137
  def delete_http_folders():
 
130
  for file_path in files_to_delete:
131
  if os.path.basename(file_path) == "config.json":
132
  continue
133
+ if os.path.isfile(path):
134
+ print(f"Deleting file: {path}")
135
+ os.remove(path)
136
+ elif os.path.isdir(path):
137
+ print(f"Deleting directory: {path}")
138
+ shutil.rmtree(path)
139
 
140
 
141
  def delete_http_folders():