fffiloni commited on
Commit
5bfa5bd
1 Parent(s): db8c96c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -13,8 +13,12 @@ embeddings = OpenAIEmbeddings()
13
  from langchain.vectorstores import Chroma
14
 
15
  from langchain.chains import RetrievalQA
 
 
 
16
  def loading_pdf():
17
  return "Loading..."
 
18
  def pdf_changes(pdf_doc):
19
  loader = OnlinePDFLoader(pdf_doc.name)
20
  documents = loader.load()
@@ -22,7 +26,7 @@ def pdf_changes(pdf_doc):
22
  db = Chroma.from_documents(texts, embeddings)
23
  retriever = db.as_retriever()
24
  global qa
25
- qa = RetrievalQA.from_chain_type(llm=OpenAI(temperature=0.5), chain_type="stuff", retriever=retriever, return_source_documents=True)
26
  return "Ready"
27
 
28
  def add_text(history, text):
 
13
  from langchain.vectorstores import Chroma
14
 
15
  from langchain.chains import RetrievalQA
16
+
17
+ from langchain.memory import ConversationBufferMemory
18
+
19
  def loading_pdf():
20
  return "Loading..."
21
+
22
  def pdf_changes(pdf_doc):
23
  loader = OnlinePDFLoader(pdf_doc.name)
24
  documents = loader.load()
 
26
  db = Chroma.from_documents(texts, embeddings)
27
  retriever = db.as_retriever()
28
  global qa
29
+ qa = RetrievalQA.from_chain_type(llm=OpenAI(temperature=0.5), chain_type="stuff", memory=ConversationBufferMemory(), retriever=retriever, return_source_documents=True)
30
  return "Ready"
31
 
32
  def add_text(history, text):