Nick Starkov commited on
Commit
5d5094e
·
1 Parent(s): 1dada6f
Files changed (2) hide show
  1. Dockerfile +6 -0
  2. app.py +4 -0
Dockerfile CHANGED
@@ -9,6 +9,12 @@ RUN apt-get update && apt-get install -y \
9
  gcc \
10
  && rm -rf /var/lib/apt/lists/*
11
 
 
 
 
 
 
 
12
  # Copy requirements file
13
  COPY requirements.txt .
14
 
 
9
  gcc \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Create cache directory and set permissions
13
+ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
14
+
15
+ # Set environment variable for Hugging Face cache
16
+ ENV HF_HOME=/app/cache
17
+
18
  # Copy requirements file
19
  COPY requirements.txt .
20
 
app.py CHANGED
@@ -1,8 +1,12 @@
 
1
  from fastapi import FastAPI
2
  from datasets import load_dataset
3
  import pandas as pd
4
  import random
5
 
 
 
 
6
  app = FastAPI()
7
 
8
  # Load the dataset once at startup
 
1
+ import os
2
  from fastapi import FastAPI
3
  from datasets import load_dataset
4
  import pandas as pd
5
  import random
6
 
7
+ # Set Hugging Face cache directory programmatically as a fallback
8
+ os.environ["HF_HOME"] = "/app/cache"
9
+
10
  app = FastAPI()
11
 
12
  # Load the dataset once at startup