Spaces:
Sleeping
Sleeping
Commit ·
2166551
1
Parent(s): 4553210
adding cache to space
Browse files- Dockerfile +1 -0
- __pycache__/app.cpython-312.pyc +0 -0
- app.py +4 -1
Dockerfile
CHANGED
|
@@ -2,6 +2,7 @@ FROM python:3.9
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
COPY requirements.txt .
|
|
|
|
| 5 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 6 |
COPY . .
|
| 7 |
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
COPY requirements.txt .
|
| 5 |
+
RUN mkdir -p /app/cache
|
| 6 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
COPY . .
|
| 8 |
|
__pycache__/app.cpython-312.pyc
ADDED
|
Binary file (1.26 kB). View file
|
|
|
app.py
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from pydantic import BaseModel
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
-
#
|
|
|
|
|
|
|
| 6 |
app = FastAPI()
|
| 7 |
|
| 8 |
# Load translation model (French)
|
|
|
|
| 1 |
+
import os
|
| 2 |
from fastapi import FastAPI
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
+
# ✅ Force Hugging Face to store model files in a writable directory
|
| 7 |
+
os.environ["TRANSFORMERS_CACHE"] = "/app/cache"
|
| 8 |
+
|
| 9 |
app = FastAPI()
|
| 10 |
|
| 11 |
# Load translation model (French)
|