File size: 677 Bytes
7948755
 
 
 
 
 
 
 
 
 
 
9e24b1c
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
with open("foo.pkl", 'rb') as f:
    new_docsearch = pickle.load(f)

docsearch = FAISS.from_texts(texts, new_docsearch)
query = "I am student and I want to know what statistical tests were used in the study, which results were statistically significant, and how could I use this when teaching biology"
docs = docsearch.similarity_search(query)
#print(docs[0].page_content)
from langchain.chains.question_answering import load_qa_chain
from langchain.llms import OpenAI
chain = load_qa_chain(OpenAI(temperature=1.2), chain_type="stuff")
resp = chain.run(input_documents=docs, question=query)
print(resp)


Template for app from:
https://huggingface.co/spaces/anzorq/chatgpt-demo