Spaces:
Runtime error
Runtime error
Abineshkumar77
commited on
Commit
·
4d9a3fc
1
Parent(s):
c9fb455
Add application file
Browse files- Dockerfile +2 -2
- app.py +4 -4
Dockerfile
CHANGED
|
@@ -14,10 +14,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 14 |
EXPOSE 80
|
| 15 |
|
| 16 |
# Define environment variable
|
| 17 |
-
ENV
|
| 18 |
|
| 19 |
# Create cache directory
|
| 20 |
-
RUN mkdir -p /app/.
|
| 21 |
|
| 22 |
# Run app.py when the container launches
|
| 23 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
|
|
|
|
| 14 |
EXPOSE 80
|
| 15 |
|
| 16 |
# Define environment variable
|
| 17 |
+
ENV HF_HOME=/app/.hf_cache
|
| 18 |
|
| 19 |
# Create cache directory
|
| 20 |
+
RUN mkdir -p /app/.hf_cache
|
| 21 |
|
| 22 |
# Run app.py when the container launches
|
| 23 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
|
app.py
CHANGED
|
@@ -4,10 +4,10 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
| 4 |
from scipy.special import softmax
|
| 5 |
from typing import Dict
|
| 6 |
|
| 7 |
-
# Set the
|
| 8 |
-
|
| 9 |
-
os.makedirs(
|
| 10 |
-
os.environ["
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
|
|
|
|
| 4 |
from scipy.special import softmax
|
| 5 |
from typing import Dict
|
| 6 |
|
| 7 |
+
# Set the HF_HOME environment variable to a writable directory
|
| 8 |
+
hf_home_dir = "./.hf_cache"
|
| 9 |
+
os.makedirs(hf_home_dir, exist_ok=True)
|
| 10 |
+
os.environ["HF_HOME"] = hf_home_dir
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
|