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