MdSourav76046 commited on
Commit
987fe62
·
verified ·
1 Parent(s): 7add098

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -55,6 +55,13 @@ async def load_model():
55
 
56
  print("🚀 Starting Text Correction API...")
57
 
 
 
 
 
 
 
 
58
  # Determine device
59
  device = "cuda" if torch.cuda.is_available() else "cpu"
60
  print(f"📱 Using device: {device}")
 
55
 
56
  print("🚀 Starting Text Correction API...")
57
 
58
+ # Set cache directory if not already set
59
+ import os
60
+ if not os.environ.get("TRANSFORMERS_CACHE"):
61
+ os.environ["TRANSFORMERS_CACHE"] = "/app/cache"
62
+ if not os.environ.get("HF_HOME"):
63
+ os.environ["HF_HOME"] = "/app/cache"
64
+
65
  # Determine device
66
  device = "cuda" if torch.cuda.is_available() else "cpu"
67
  print(f"📱 Using device: {device}")