fffiloni commited on
Commit
302b34f
1 Parent(s): 705c1e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -5,11 +5,10 @@ from langchain.document_loaders import OnlinePDFLoader
5
  from langchain.text_splitter import CharacterTextSplitter
6
  text_splitter = CharacterTextSplitter(chunk_size=350, chunk_overlap=0)
7
 
8
- from langchain.llms import HuggingFaceHub
9
- flan_ul2 = HuggingFaceHub(repo_id="google/flan-ul2", model_kwargs={"temperature":0.1, "max_new_tokens":300})
10
 
11
- from langchain.embeddings import HuggingFaceHubEmbeddings
12
- embeddings = HuggingFaceHubEmbeddings()
13
 
14
  from langchain.vectorstores import Chroma
15
 
@@ -23,7 +22,7 @@ def pdf_changes(pdf_doc):
23
  db = Chroma.from_documents(texts, embeddings)
24
  retriever = db.as_retriever()
25
  global qa
26
- qa = RetrievalQA.from_chain_type(llm=flan_ul2, chain_type="stuff", retriever=retriever, return_source_documents=True)
27
  return "Ready"
28
 
29
  def add_text(history, text):
 
5
  from langchain.text_splitter import CharacterTextSplitter
6
  text_splitter = CharacterTextSplitter(chunk_size=350, chunk_overlap=0)
7
 
8
+ from langchain.llms import OpenAI
 
9
 
10
+ from langchain.embeddings import OpenAIEmbeddings
11
+ embeddings = OpenAIEmbeddings()
12
 
13
  from langchain.vectorstores import Chroma
14
 
 
22
  db = Chroma.from_documents(texts, embeddings)
23
  retriever = db.as_retriever()
24
  global qa
25
+ qa = RetrievalQA.from_chain_type(llm=OpenAI(), chain_type="stuff", retriever=retriever, return_source_documents=True)
26
  return "Ready"
27
 
28
  def add_text(history, text):