fix: cache error
Browse files- Dockerfile +3 -0
- app.py +4 -0
Dockerfile
CHANGED
@@ -10,6 +10,9 @@ COPY requirements.txt .
|
|
10 |
# Install the dependencies
|
11 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
12 |
|
|
|
|
|
|
|
13 |
# Copy the rest of the application code into the container
|
14 |
COPY . .
|
15 |
|
|
|
10 |
# Install the dependencies
|
11 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
12 |
|
13 |
+
# Create a writable cache directory
|
14 |
+
RUN mkdir -p /app/.cache
|
15 |
+
|
16 |
# Copy the rest of the application code into the container
|
17 |
COPY . .
|
18 |
|
app.py
CHANGED
@@ -2,6 +2,10 @@ from fastapi import FastAPI
|
|
2 |
from pydantic import BaseModel
|
3 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
4 |
import torch
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Inisialisasi model dan tokenizer
|
7 |
model_name = "w11wo/indonesian-roberta-base-sentiment-classifier"
|
|
|
2 |
from pydantic import BaseModel
|
3 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
4 |
import torch
|
5 |
+
import os
|
6 |
+
|
7 |
+
# Set the cache directory to a writable location
|
8 |
+
os.environ['TRANSFORMERS_CACHE'] = '/app/.cache'
|
9 |
|
10 |
# Inisialisasi model dan tokenizer
|
11 |
model_name = "w11wo/indonesian-roberta-base-sentiment-classifier"
|