M Farrel Danendra Rachim commited on
Commit
bdd0296
·
1 Parent(s): 05d7234
Files changed (1) hide show
  1. main.py +7 -0
main.py CHANGED
@@ -4,6 +4,13 @@ from pydantic import BaseModel
4
  from transformers import pipeline
5
  from happytransformer import HappyTextToText, TTSettings
6
 
 
 
 
 
 
 
 
7
  app = FastAPI()
8
 
9
  # Load models at startup
 
4
  from transformers import pipeline
5
  from happytransformer import HappyTextToText, TTSettings
6
 
7
+ import os
8
+
9
+ # Redirect cache to a local writable path
10
+ os.environ["HF_HOME"] = "/tmp/huggingface"
11
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
12
+ os.makedirs("/tmp/huggingface", exist_ok=True)
13
+
14
  app = FastAPI()
15
 
16
  # Load models at startup