Ravi Pandey commited on
Commit
fd1bd47
1 Parent(s): 12b3d87

Docker deploy

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. server/caption_server.py +2 -7
Dockerfile CHANGED
@@ -8,7 +8,7 @@ COPY ./requirements.txt /code/requirements.txt
8
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
9
 
10
  # Set environment variable for Transformers cache
11
- ENV TRANSFORMERS_CACHE=/code/.cache
12
 
13
  # Copy the rest of the application code
14
  COPY . .
 
8
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
9
 
10
  # Set environment variable for Transformers cache
11
+ ENV HF_HOME=/tmp/transformers_cache
12
 
13
  # Copy the rest of the application code
14
  COPY . .
server/caption_server.py CHANGED
@@ -19,18 +19,13 @@ app.add_middleware(
19
  allow_headers=["*"],
20
  )
21
 
22
- import os
23
-
24
- # Get the cache directory from the environment variable
25
- hf_cache_dir = os.getenv("HF_HOME", default="/.cache")
26
 
27
 
28
  # Initialize the BLIP and GIT models for image captioning
29
  blip_model_name = "Salesforce/blip-image-captioning-large"
30
  git_model_name = "microsoft/git-large-coco"
31
- # Use hf_cache_dir in the model initialization
32
- blip_pipeline = pipeline("image-to-text", model=blip_model_name, cache_dir=hf_cache_dir)
33
- git_coco_pipeline = pipeline("image-to-text", model=git_model_name, cache_dir=hf_cache_dir)
34
 
35
  # Initialize the model for semantic similarity
36
  model = SentenceTransformer('all-MiniLM-L6-v2')
 
19
  allow_headers=["*"],
20
  )
21
 
 
 
 
 
22
 
23
 
24
  # Initialize the BLIP and GIT models for image captioning
25
  blip_model_name = "Salesforce/blip-image-captioning-large"
26
  git_model_name = "microsoft/git-large-coco"
27
+ blip_pipeline = pipeline("image-to-text", model=blip_model_name )
28
+ git_coco_pipeline = pipeline("image-to-text", model=git_model_name)
 
29
 
30
  # Initialize the model for semantic similarity
31
  model = SentenceTransformer('all-MiniLM-L6-v2')