pleonova commited on
Commit
7d6a1d4
1 Parent(s): 7a8b830

Sets the TRANSFORMERS_CACHE environment variable as a fallback

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -1,6 +1,10 @@
 
1
  from fastapi import FastAPI
2
  from transformers import pipeline
3
 
 
 
 
4
  app = FastAPI()
5
  classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
6
 
 
1
+ import os
2
  from fastapi import FastAPI
3
  from transformers import pipeline
4
 
5
+ # Set a custom Hugging Face cache directory
6
+ os.environ["TRANSFORMERS_CACHE"] = "/app/.cache"
7
+
8
  app = FastAPI()
9
  classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
10