parth parekh commited on
Commit
dfb2eec
·
1 Parent(s): 1e494e3

changed the cache directory

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -13,8 +13,9 @@ app = FastAPI(
13
 
14
  class ContactDetector:
15
  def __init__(self):
16
- self.tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
17
- self.model = DistilBertForSequenceClassification.from_pretrained('distilbert-base-uncased', num_labels=2)
 
18
  self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
19
  self.model.to(self.device)
20
  self.model.eval()
 
13
 
14
  class ContactDetector:
15
  def __init__(self):
16
+ cache_dir = "/app/model_cache"
17
+ self.tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased', cache_dir=cache_dir)
18
+ self.model = DistilBertForSequenceClassification.from_pretrained('distilbert-base-uncased', num_labels=2, cache_dir=cache_dir)
19
  self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
20
  self.model.to(self.device)
21
  self.model.eval()