rapsar commited on
Commit
2847e2d
·
verified ·
1 Parent(s): e128fa9

added login for gated models

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -29,6 +29,12 @@ def pil_to_binstring(img: Image.Image, thresh: int = 128) -> str:
29
  _LLM_CACHE = {} # model_id -> (tokenizer, model)
30
 
31
  def load_llm(model_id: str):
 
 
 
 
 
 
32
  if model_id in _LLM_CACHE:
33
  return _LLM_CACHE[model_id]
34
 
 
29
  _LLM_CACHE = {} # model_id -> (tokenizer, model)
30
 
31
  def load_llm(model_id: str):
32
+ # Add authentication for gated models
33
+ from huggingface_hub import login
34
+ token = os.environ.get("HF_TOKEN")
35
+ if token:
36
+ login(token=token)
37
+
38
  if model_id in _LLM_CACHE:
39
  return _LLM_CACHE[model_id]
40