Spaces:
Runtime error
Runtime error
File size: 781 Bytes
7948755 9e24b1c 35e63fa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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
https://blog.devgenius.io/chat-with-document-s-using-openai-chatgpt-api-and-text-embedding-6a0ce3dc8bc8 |