Penality commited on
Commit
ace6078
·
verified ·
1 Parent(s): 9ed906a

Update app.py

Browse files

updated the authentication to use HfApi instead of login to fix this error
Traceback (most recent call last):
File "/home/user/app/app.py", line 23, in <module>
login(api_token) # Authenticate with Hugging Face
TypeError: 'module' object is not callable

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -6,7 +6,7 @@ from transformers import pipeline
6
  from sentence_transformers import SentenceTransformer
7
  import faiss
8
  import numpy as np
9
- import huggingface_hub as login
10
  import re
11
  import unicodedata
12
  from dotenv import load_dotenv
@@ -20,7 +20,7 @@ assert os.getenv("TOGETHER_API_KEY"), "api key missing"
20
  api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
21
  print(api_token)
22
  if api_token:
23
- login(api_token) # Authenticate with Hugging Face
24
 
25
 
26
  # Load LLaMA-2 Model
 
6
  from sentence_transformers import SentenceTransformer
7
  import faiss
8
  import numpy as np
9
+ import huggingface_hub as HfApi
10
  import re
11
  import unicodedata
12
  from dotenv import load_dotenv
 
20
  api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
21
  print(api_token)
22
  if api_token:
23
+ HfApi().set_access_token(api_token) # Authenticate with Hugging Face
24
 
25
 
26
  # Load LLaMA-2 Model