Arthur Passuello commited on
Commit
0eb61bf
·
1 Parent(s): 0fb647e

Fix minor variable issue

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -29,8 +29,8 @@ os.environ["STREAMLIT_SERVER_HEADLESS"] = "true"
29
  os.environ["STREAMLIT_SERVER_ENABLE_CORS"] = "false"
30
  os.environ["STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION"] = "false"
31
 
32
- # Setup cache directories for model downloads (HuggingFace Spaces compatible)
33
- cache_base = "/tmp/.cache" if IS_HF_SPACES else str(Path.home() / ".cache")
34
  os.environ.setdefault("HF_HOME", f"{cache_base}/huggingface")
35
  os.environ.setdefault("TRANSFORMERS_CACHE", f"{cache_base}/huggingface/transformers")
36
  os.environ.setdefault("SENTENCE_TRANSFORMERS_HOME", f"{cache_base}/sentence-transformers")
@@ -46,9 +46,9 @@ for cache_dir in [
46
  except Exception as e:
47
  logger.warning(f"Could not create cache directory {cache_dir}: {e}")
48
 
49
- # HuggingFace Spaces environment detection
50
- IS_HF_SPACES = os.getenv("SPACE_ID") is not None
51
- IS_LOCAL_DEV = not IS_HF_SPACES
52
 
53
  # Add project root to path
54
  project_root = Path(__file__).parent
 
29
  os.environ["STREAMLIT_SERVER_ENABLE_CORS"] = "false"
30
  os.environ["STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION"] = "false"
31
 
32
+ # Setup cache directories for HuggingFace Spaces
33
+ cache_base = "/tmp/.cache"
34
  os.environ.setdefault("HF_HOME", f"{cache_base}/huggingface")
35
  os.environ.setdefault("TRANSFORMERS_CACHE", f"{cache_base}/huggingface/transformers")
36
  os.environ.setdefault("SENTENCE_TRANSFORMERS_HOME", f"{cache_base}/sentence-transformers")
 
46
  except Exception as e:
47
  logger.warning(f"Could not create cache directory {cache_dir}: {e}")
48
 
49
+ # Environment constants
50
+ IS_HF_SPACES = True # This app is designed for HuggingFace Spaces deployment
51
+ IS_LOCAL_DEV = False
52
 
53
  # Add project root to path
54
  project_root = Path(__file__).parent