Spaces:
Sleeping
Sleeping
arun3676 commited on
Commit ·
94a1753
1
Parent(s): ab058b0
Fix permission error: Use /tmp for cache directory in Docker/HF Spaces
Browse files- matrix_final.py +4 -1
matrix_final.py
CHANGED
|
@@ -500,7 +500,10 @@ st.markdown(
|
|
| 500 |
|
| 501 |
@st.cache_resource
|
| 502 |
def get_analyzer():
|
| 503 |
-
|
|
|
|
|
|
|
|
|
|
| 504 |
|
| 505 |
|
| 506 |
analyzer = get_analyzer()
|
|
|
|
| 500 |
|
| 501 |
@st.cache_resource
|
| 502 |
def get_analyzer():
|
| 503 |
+
# Use /tmp for cache in Docker/HF Spaces (always writable)
|
| 504 |
+
# Use .analyzer_cache for local development
|
| 505 |
+
cache_dir = "/tmp/.analyzer_cache" if os.path.exists("/app") else ".analyzer_cache"
|
| 506 |
+
return CodeAnalyzer(cache_dir=cache_dir)
|
| 507 |
|
| 508 |
|
| 509 |
analyzer = get_analyzer()
|