Muhammad Musa Zulfiqar commited on
Commit
c2f039f
·
1 Parent(s): 0fa4425

transfomers cache env var added

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. app.py +1 -0
Dockerfile CHANGED
@@ -4,6 +4,9 @@ FROM python:3.9
4
  # Set the working directory inside the container
5
  WORKDIR /
6
 
 
 
 
7
  # Copy and install dependencies
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
 
4
  # Set the working directory inside the container
5
  WORKDIR /
6
 
7
+ # Set environment variable for writable Hugging Face cache
8
+ ENV TRANSFORMERS_CACHE=/tmp/huggingface
9
+
10
  # Copy and install dependencies
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  import re
 
3
  from fastapi import FastAPI, HTTPException
4
  from fastapi.middleware.cors import CORSMiddleware
5
  from pydantic import BaseModel
 
1
  import os
2
  import re
3
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface"
4
  from fastapi import FastAPI, HTTPException
5
  from fastapi.middleware.cors import CORSMiddleware
6
  from pydantic import BaseModel