ahmadmac commited on
Commit
1878c77
·
verified ·
1 Parent(s): 81766ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -8,8 +8,7 @@ from langchain.schema import Document
8
  from langchain_community.vectorstores import Qdrant
9
  from langchain.chains import RetrievalQA
10
  from langchain.llms import HuggingFaceHub
11
-
12
- # Set up the RetrievalQA model
13
  with open("brookline_data.txt", "r") as f:
14
  data = f.read()
15
  text_splitter = RecursiveCharacterTextSplitter(chunk_size=100, chunk_overlap=20)
@@ -17,7 +16,7 @@ splitted_data = text_splitter.split_text(data)
17
  embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-mpnet-base-v2')
18
  retriever = Qdrant.as_retriever()
19
 
20
- llm = HuggingFaceHub(repo_id="ahmadmac/Trained-T5-large", model_kwargs={"temperature": 0.5, "max_length": 512},huggingfacehub_api_token=)
21
  qna = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever)
22
  prompt_template = """ you are a highly knowledgeable AI assistant. Engage in a conversation with the user. Your main goal is to provide clear and informative answers to the user's questions.
23
  User: {question}
 
8
  from langchain_community.vectorstores import Qdrant
9
  from langchain.chains import RetrievalQA
10
  from langchain.llms import HuggingFaceHub
11
+ hf_token=os.environ["HUGGINGFACEHUB_API_TOKEN"]
 
12
  with open("brookline_data.txt", "r") as f:
13
  data = f.read()
14
  text_splitter = RecursiveCharacterTextSplitter(chunk_size=100, chunk_overlap=20)
 
16
  embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-mpnet-base-v2')
17
  retriever = Qdrant.as_retriever()
18
 
19
+ llm = HuggingFaceHub(repo_id="ahmadmac/Trained-T5-large", model_kwargs={"temperature": 0.5, "max_length": 512},huggingfacehub_api_token=hf_token)
20
  qna = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever)
21
  prompt_template = """ you are a highly knowledgeable AI assistant. Engage in a conversation with the user. Your main goal is to provide clear and informative answers to the user's questions.
22
  User: {question}