Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,14 @@
|
|
1 |
import os
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
from fastapi import FastAPI, Header, HTTPException, Body
|
|
|
1 |
import os
|
2 |
|
3 |
+
cache_dir = os.path.join(os.getcwd(), ".cache")
|
4 |
+
try:
|
5 |
+
os.makedirs(cache_dir, exist_ok=True)
|
6 |
+
except PermissionError:
|
7 |
+
cache_dir = "/tmp/.cache"
|
8 |
+
os.makedirs(cache_dir, exist_ok=True)
|
9 |
+
|
10 |
+
os.environ['TRANSFORMERS_CACHE'] = cache_dir
|
11 |
+
os.environ['HF_HOME'] = cache_dir
|
12 |
|
13 |
|
14 |
from fastapi import FastAPI, Header, HTTPException, Body
|