Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,15 +5,19 @@ from langchain.schema import HumanMessage, AIMessage
|
|
5 |
from langchain.chains import create_retrieval_chain, create_history_aware_retriever
|
6 |
from langchain.chains.combine_documents import create_stuff_documents_chain
|
7 |
from langchain.vectorstores import Chroma
|
8 |
-
from
|
9 |
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
|
10 |
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, pipeline
|
11 |
|
12 |
import os
|
13 |
from huggingface_hub import login
|
14 |
|
15 |
-
# Authenticate using
|
16 |
-
hf_token = os.getenv("SP_7")
|
|
|
|
|
|
|
|
|
17 |
login(token=hf_token)
|
18 |
|
19 |
|
|
|
5 |
from langchain.chains import create_retrieval_chain, create_history_aware_retriever
|
6 |
from langchain.chains.combine_documents import create_stuff_documents_chain
|
7 |
from langchain.vectorstores import Chroma
|
8 |
+
from langchain_community.llms import HuggingFacePipeline
|
9 |
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
|
10 |
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, pipeline
|
11 |
|
12 |
import os
|
13 |
from huggingface_hub import login
|
14 |
|
15 |
+
# Authenticate using your Hugging Face token stored as 'SP_7'
|
16 |
+
hf_token = os.getenv("SP_7") # Reads the token from the environment variable
|
17 |
+
if hf_token is None:
|
18 |
+
raise ValueError("Hugging Face token 'SP_7' is not set in the environment variables.")
|
19 |
+
|
20 |
+
# Log in to Hugging Face
|
21 |
login(token=hf_token)
|
22 |
|
23 |
|