taratrankennedy commited on
Commit
24e4881
1 Parent(s): e05602f

Storing tokens using Hugging Face

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -12,8 +12,13 @@ from langchain.chains import ConversationalRetrievalChain
12
  from langchain.memory import ChatMessageHistory, ConversationBufferMemory
13
  from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser
14
  import time
 
15
 
16
- HUGGINGFACEHUB_API_TOKEN = st.secrets['HUGGINGFACEHUB_API_TOKEN']
 
 
 
 
17
 
18
  @dataclass
19
  class Message:
 
12
  from langchain.memory import ChatMessageHistory, ConversationBufferMemory
13
  from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser
14
  import time
15
+ from transformers import AutoModel
16
 
17
+ HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
18
+ from huggingface_hub import HfApi
19
+ api = HfApi()
20
+ api.set_access_token(HUGGINGFACEHUB_API_TOKEN)
21
+ user = api.whoami()
22
 
23
  @dataclass
24
  class Message: