Spaces:
Runtime error
Runtime error
ubermenchh
commited on
Commit
·
a205019
1
Parent(s):
7ecf05f
Update app.py
Browse files
app.py
CHANGED
@@ -11,12 +11,12 @@ def loading_pdf(): return 'Loading...'
|
|
11 |
def pdf_changes(pdf_doc, repo_id):
|
12 |
loader = OnlinePDFLoader(pdf_doc.name)
|
13 |
documents = loader.load()
|
14 |
-
text_splitter = CharacterTextSplitter(chunk_size=
|
15 |
texts = text_splitter.split_documents(documents)
|
16 |
embeddings = HuggingFaceHubEmbeddings()
|
17 |
db = Chroma.from_documents(texts, embeddings)
|
18 |
retriever = db.as_retriever()
|
19 |
-
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={'temperature': 0.
|
20 |
global qa
|
21 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type='stuff', retriever=retriever, return_source_documents=True)
|
22 |
return "Ready"
|
|
|
11 |
def pdf_changes(pdf_doc, repo_id):
|
12 |
loader = OnlinePDFLoader(pdf_doc.name)
|
13 |
documents = loader.load()
|
14 |
+
text_splitter = CharacterTextSplitter(chunk_size=1024, chunk_overlap=0)
|
15 |
texts = text_splitter.split_documents(documents)
|
16 |
embeddings = HuggingFaceHubEmbeddings()
|
17 |
db = Chroma.from_documents(texts, embeddings)
|
18 |
retriever = db.as_retriever()
|
19 |
+
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={'temperature': 0.5, 'max_new_tokens': 2096})
|
20 |
global qa
|
21 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type='stuff', retriever=retriever, return_source_documents=True)
|
22 |
return "Ready"
|