Ravi Pandey commited on
Commit
c053b94
1 Parent(s): bcc8b54

Docker deploy

Browse files
Files changed (1) hide show
  1. server/caption_server.py +5 -2
server/caption_server.py CHANGED
@@ -19,11 +19,14 @@ app.add_middleware(
19
  allow_headers=["*"],
20
  )
21
 
 
 
 
22
  # Initialize the BLIP and GIT models for image captioning
23
  blip_model_name = "Salesforce/blip-image-captioning-large"
24
  git_model_name = "microsoft/git-large-coco"
25
- blip_pipeline = pipeline("image-to-text", model=blip_model_name)
26
- git_coco_pipeline = pipeline("image-to-text", model=git_model_name)
27
 
28
  # Initialize the model for semantic similarity
29
  model = SentenceTransformer('all-MiniLM-L6-v2')
 
19
  allow_headers=["*"],
20
  )
21
 
22
+ import os
23
+ os.environ['HF_HOME'] = '/cache'
24
+
25
  # Initialize the BLIP and GIT models for image captioning
26
  blip_model_name = "Salesforce/blip-image-captioning-large"
27
  git_model_name = "microsoft/git-large-coco"
28
+ blip_pipeline = pipeline("image-to-text", model=blip_model_name , cache_dir='/cache')
29
+ git_coco_pipeline = pipeline("image-to-text", model=git_model_name , cache_dir='/cache')
30
 
31
  # Initialize the model for semantic similarity
32
  model = SentenceTransformer('all-MiniLM-L6-v2')