Spaces:
Runtime error
Runtime error
Amish Kushwaha commited on
Commit ·
adc5557
1
Parent(s): 6d2a9d7
Fix transformer cache issue attempt 2
Browse files- app.py +5 -2
- cache/.gitkeep +0 -0
app.py
CHANGED
|
@@ -3,8 +3,11 @@ from fastapi import FastAPI
|
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Load your Hugging Face model
|
| 10 |
model = pipeline("text-generation", model="devops-bda/Abap")
|
|
|
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
+
CACHE_DIR = "/app/cache"
|
| 7 |
+
|
| 8 |
+
# Ensure the cache directory is writable and exists
|
| 9 |
+
os.environ["TRANSFORMERS_CACHE"] = CACHE_DIR
|
| 10 |
+
os.makedirs(CACHE_DIR, exist_ok=True) # Create the directory if it doesn't exist
|
| 11 |
|
| 12 |
# Load your Hugging Face model
|
| 13 |
model = pipeline("text-generation", model="devops-bda/Abap")
|
cache/.gitkeep
ADDED
|
File without changes
|