Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,12 +21,12 @@ def pdf_changes(pdf_doc, repo_id):
|
|
21 |
|
22 |
loader = OnlinePDFLoader(pdf_doc.name)
|
23 |
documents = loader.load()
|
24 |
-
text_splitter = CharacterTextSplitter(chunk_size=
|
25 |
texts = text_splitter.split_documents(documents)
|
26 |
embeddings = HuggingFaceHubEmbeddings()
|
27 |
db = Chroma.from_documents(texts, embeddings)
|
28 |
retriever = db.as_retriever()
|
29 |
-
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature":0.1, "max_new_tokens":
|
30 |
global qa
|
31 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever, return_source_documents=True)
|
32 |
return "Ready"
|
|
|
21 |
|
22 |
loader = OnlinePDFLoader(pdf_doc.name)
|
23 |
documents = loader.load()
|
24 |
+
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
25 |
texts = text_splitter.split_documents(documents)
|
26 |
embeddings = HuggingFaceHubEmbeddings()
|
27 |
db = Chroma.from_documents(texts, embeddings)
|
28 |
retriever = db.as_retriever()
|
29 |
+
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature":0.1, "max_new_tokens":250})
|
30 |
global qa
|
31 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever, return_source_documents=True)
|
32 |
return "Ready"
|