Update backend/agent_instance.py
Browse files
backend/agent_instance.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
import sys
|
4 |
import os
|
5 |
|
@@ -9,7 +7,9 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..",
|
|
9 |
from txagent.txagent import TxAgent # ✅ Now this will work
|
10 |
|
11 |
def init_agent():
|
12 |
-
|
|
|
|
|
13 |
os.environ["TRANSFORMERS_CACHE"] = model_cache_dir
|
14 |
os.environ["HF_HOME"] = model_cache_dir
|
15 |
|
|
|
|
|
|
|
1 |
import sys
|
2 |
import os
|
3 |
|
|
|
7 |
from txagent.txagent import TxAgent # ✅ Now this will work
|
8 |
|
9 |
def init_agent():
|
10 |
+
# ✅ Use /data for persistent model caching on Hugging Face Spaces
|
11 |
+
model_cache_dir = "/data/txagent_models"
|
12 |
+
os.makedirs(model_cache_dir, exist_ok=True)
|
13 |
os.environ["TRANSFORMERS_CACHE"] = model_cache_dir
|
14 |
os.environ["HF_HOME"] = model_cache_dir
|
15 |
|