Update main.py
Browse files
main.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import os
|
|
|
|
|
|
|
|
|
2 |
from fastapi import FastAPI, Request
|
3 |
from pydantic import BaseModel
|
4 |
from transformers import pipeline
|
5 |
|
6 |
-
# ✅ Set cache to writable directory
|
7 |
-
os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
|
8 |
-
|
9 |
app = FastAPI()
|
10 |
|
11 |
# Load model once when the app starts
|
|
|
1 |
import os
|
2 |
+
# ✅ Set cache to writable directory
|
3 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
|
4 |
+
os.environ["HF_HOME"] = "/tmp/hf-home"
|
5 |
+
|
6 |
from fastapi import FastAPI, Request
|
7 |
from pydantic import BaseModel
|
8 |
from transformers import pipeline
|
9 |
|
|
|
|
|
|
|
10 |
app = FastAPI()
|
11 |
|
12 |
# Load model once when the app starts
|