MohitG012 commited on
Commit
be2288f
·
verified ·
1 Parent(s): 488d1dd

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +5 -0
src/streamlit_app.py CHANGED
@@ -15,6 +15,11 @@ from huggingface_hub import login
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
16
  print(device)
17
 
 
 
 
 
 
18
  # Load assets
19
  @st.cache_resource
20
  def load_assets(asset_dir = os.path.join(os.path.dirname(__file__), "Assets")):
 
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
16
  print(device)
17
 
18
+ # Use Hugging Face recommended writable temp cache in Spaces
19
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
20
+ os.environ["HF_HOME"] = "/tmp/hf_home"
21
+ os.environ["SENTENCE_TRANSFORMERS_HOME"] = "/tmp/sbert"
22
+
23
  # Load assets
24
  @st.cache_resource
25
  def load_assets(asset_dir = os.path.join(os.path.dirname(__file__), "Assets")):