MasteredUltraInstinct commited on
Commit
74a4a8f
·
verified ·
1 Parent(s): b78a42b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -1,9 +1,14 @@
 
1
  from fastapi import FastAPI
2
  from pydantic import BaseModel
3
  from fastapi.responses import JSONResponse
4
  from transformers import pipeline
5
 
6
- # Load a small, CPU-friendly instruction-following model
 
 
 
 
7
  pipe = pipeline("text2text-generation", model="google/flan-t5-small", max_new_tokens=100)
8
 
9
  app = FastAPI()
 
1
+ import os
2
  from fastapi import FastAPI
3
  from pydantic import BaseModel
4
  from fastapi.responses import JSONResponse
5
  from transformers import pipeline
6
 
7
+ # Set writable cache location
8
+ os.environ["TRANSFORMERS_CACHE"] = "/data/cache"
9
+ os.makedirs("/data/cache", exist_ok=True)
10
+
11
+ # ✅ Load model safely
12
  pipe = pipeline("text2text-generation", model="google/flan-t5-small", max_new_tokens=100)
13
 
14
  app = FastAPI()