Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,17 @@ from fastapi import FastAPI
|
|
| 4 |
from pydantic import BaseModel
|
| 5 |
import torch
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Initialize FastAPI
|
| 13 |
app = FastAPI(title="Check-ins Classifier API", version="1.0")
|
|
|
|
| 4 |
from pydantic import BaseModel
|
| 5 |
import torch
|
| 6 |
|
| 7 |
+
import os
|
| 8 |
+
|
| 9 |
+
# 🧱 Set all possible cache directories to writable locations
|
| 10 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 11 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
|
| 12 |
+
os.environ["HF_DATASETS_CACHE"] = "/tmp/huggingface/datasets"
|
| 13 |
+
os.environ["XDG_CACHE_HOME"] = "/tmp/huggingface" # prevents /.cache access
|
| 14 |
+
|
| 15 |
+
# Ensure directory exists
|
| 16 |
+
os.makedirs("/tmp/huggingface/transformers", exist_ok=True)
|
| 17 |
+
|
| 18 |
|
| 19 |
# Initialize FastAPI
|
| 20 |
app = FastAPI(title="Check-ins Classifier API", version="1.0")
|