vishalsh13 commited on
Commit
5b42a86
·
1 Parent(s): 50f0871

Update for folder write error

Browse files
Files changed (2) hide show
  1. Dockerfile +12 -2
  2. config.py +1 -1
Dockerfile CHANGED
@@ -4,13 +4,23 @@ FROM python:3.9-slim
4
 
5
  WORKDIR /app
6
 
 
7
  COPY requirements.txt .
8
  RUN pip install --no-cache-dir -r requirements.txt
9
 
 
10
  COPY . .
11
 
12
  # Set environment variables for writable directories
13
- ENV TRANSFORMERS_CACHE=/workspace/.cache/transformers
14
- ENV HF_HOME=/workspace/.cache/huggingface
 
 
 
 
 
 
 
 
15
 
16
  CMD ["python", "app.py"]
 
4
 
5
  WORKDIR /app
6
 
7
+ # Copy dependencies and install them
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
+ # Copy application files
12
  COPY . .
13
 
14
  # Set environment variables for writable directories
15
+ ENV HF_HOME=/tmp/.cache/huggingface
16
+ # Cache directory for Hugging Face
17
+ ENV TRANSFORMERS_CACHE=/tmp/.cache/transformers
18
+ # Legacy cache for compatibility
19
+ ENV BASE_PATH=/tmp/vector_db
20
+ # Base path for vector database and metadata
21
+
22
+ # Set environment variable for Hugging Face authentication token
23
+ # The `hkey` secret from Hugging Face Spaces will automatically populate this
24
+ ENV hkey=${hkey}
25
 
26
  CMD ["python", "app.py"]
config.py CHANGED
@@ -9,6 +9,6 @@ v_dataset_url = "https://huggingface.co/datasets/vishalsh13/Dataset1/tree/main/d
9
  v_auth_token = os.getenv("hkey") # The secret name is `hkey`
10
 
11
  # Paths for vector database and metadata
12
- v_base_path = "/workspace/vector_db" # Writable directory in Hugging Face Spaces
13
  v_vector_folder = os.path.join(v_base_path, "vectors")
14
  v_metadata_file = os.path.join(v_base_path, "metadata.json")
 
9
  v_auth_token = os.getenv("hkey") # The secret name is `hkey`
10
 
11
  # Paths for vector database and metadata
12
+ v_base_path = "/tmp/vector_db" # Writable directory
13
  v_vector_folder = os.path.join(v_base_path, "vectors")
14
  v_metadata_file = os.path.join(v_base_path, "metadata.json")