service-internal commited on
Commit
5a56923
·
verified ·
1 Parent(s): 86b6cd2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -0
main.py CHANGED
@@ -1,7 +1,11 @@
 
1
  from fastapi import FastAPI, Request
2
  from pydantic import BaseModel
3
  from transformers import pipeline
4
 
 
 
 
5
  app = FastAPI()
6
 
7
  # Load model once when the app starts
 
1
+ import os
2
  from fastapi import FastAPI, Request
3
  from pydantic import BaseModel
4
  from transformers import pipeline
5
 
6
+ # Set cache dir to a writable location
7
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
8
+
9
  app = FastAPI()
10
 
11
  # Load model once when the app starts