mjpsm commited on
Commit
5ddb4bd
·
verified ·
1 Parent(s): d379983

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -4,10 +4,10 @@ from fastapi import FastAPI
4
  from pydantic import BaseModel
5
  import torch
6
 
7
- # ✅ Fix Hugging Face cache permissions
8
- os.environ["HF_HOME"] = "/app/hf_cache"
9
- os.environ["TRANSFORMERS_CACHE"] = "/app/hf_cache"
10
- os.makedirs("/app/hf_cache", exist_ok=True)
11
 
12
  # Initialize FastAPI
13
  app = FastAPI(title="Check-ins Classifier API", version="1.0")
@@ -48,3 +48,4 @@ async def predict(data: InputText):
48
  async def home():
49
  return {"message": "Welcome to the Check-ins Classifier API. Use POST /predict to classify text."}
50
 
 
 
4
  from pydantic import BaseModel
5
  import torch
6
 
7
+ # ✅ Fix for Hugging Face Spaces permission issue
8
+ os.environ["HF_HOME"] = "/tmp/hf_cache"
9
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
10
+ os.makedirs("/tmp/hf_cache", exist_ok=True)
11
 
12
  # Initialize FastAPI
13
  app = FastAPI(title="Check-ins Classifier API", version="1.0")
 
48
  async def home():
49
  return {"message": "Welcome to the Check-ins Classifier API. Use POST /predict to classify text."}
50
 
51
+