pcuenq HF staff commited on
Commit
383d050
1 Parent(s): 8d4ed6d

Set cache to a directory

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. cache/.keep +0 -0
app.py CHANGED
@@ -2,6 +2,8 @@ import os
2
  import shutil
3
  import subprocess
4
  import signal
 
 
5
  os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
6
  import gradio as gr
7
 
@@ -32,9 +34,7 @@ def clear_hf_cache_space():
32
  for repo in scan.repos:
33
  if repo.repo_type == "model":
34
  to_delete.extend([rev.commit_hash for rev in repo.revisions])
35
-
36
  scan.delete_revisions(*to_delete).execute()
37
-
38
  print("Cache has been cleared")
39
 
40
  def upload_to_hub(path, upload_repo, hf_path, token):
 
2
  import shutil
3
  import subprocess
4
  import signal
5
+
6
+ os.environ["HF_HUB_CACHE"] = "cache"
7
  os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
8
  import gradio as gr
9
 
 
34
  for repo in scan.repos:
35
  if repo.repo_type == "model":
36
  to_delete.extend([rev.commit_hash for rev in repo.revisions])
 
37
  scan.delete_revisions(*to_delete).execute()
 
38
  print("Cache has been cleared")
39
 
40
  def upload_to_hub(path, upload_repo, hf_path, token):
cache/.keep ADDED
File without changes