aznasut commited on
Commit
63d221c
·
1 Parent(s): cbc96c3

add cache dir

Browse files
Files changed (1) hide show
  1. main.py +8 -0
main.py CHANGED
@@ -13,12 +13,20 @@ from PIL import Image
13
  from cachetools import Cache
14
  import torch
15
  import torch.nn.functional as F
 
16
  from models import (
17
  FileImageDetectionResponse,
18
  UrlImageDetectionResponse,
19
  ImageUrlsRequest,
20
  )
21
 
 
 
 
 
 
 
 
22
 
23
  app = FastAPI()
24
 
 
13
  from cachetools import Cache
14
  import torch
15
  import torch.nn.functional as F
16
+ import os
17
  from models import (
18
  FileImageDetectionResponse,
19
  UrlImageDetectionResponse,
20
  ImageUrlsRequest,
21
  )
22
 
23
+ PATH = '/home/ahmadzen/.cache/huggingface/'
24
+ DATASETPATH = '/home/ahmadzen/.cache/huggingface/datasests/'
25
+ MODELPATH = '/home/ahmadzen/.cache/huggingface/model'
26
+ os.environ['TRANSFORMERS_CACHE'] = MODELPATH
27
+ os.environ['HF_HOME'] = PATH
28
+ os.environ['HF_DATASETS_CACHE'] = DATASETPATH
29
+ os.environ['TORCH_HOME'] = PATH
30
 
31
  app = FastAPI()
32