Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,10 +16,10 @@ def load_doc(pdf_doc):
|
|
16 |
loader = PyMuPDFLoader(pdf_doc.name)
|
17 |
documents = loader.load()
|
18 |
embedding = HuggingFaceEmbeddings()
|
19 |
-
text_splitter = CharacterTextSplitter(chunk_size=
|
20 |
text = text_splitter.split_documents(documents)
|
21 |
db = Chroma.from_documents(text, embedding)
|
22 |
-
llm = HuggingFaceHub(repo_id="OpenAssistant/oasst-sft-1-pythia-12b", model_kwargs={"temperature": 1.0, "max_length":
|
23 |
global chain
|
24 |
chain = RetrievalQA.from_chain_type(llm=llm,chain_type="stuff",retriever=db.as_retriever())
|
25 |
return 'Document has successfully been loaded'
|
|
|
16 |
loader = PyMuPDFLoader(pdf_doc.name)
|
17 |
documents = loader.load()
|
18 |
embedding = HuggingFaceEmbeddings()
|
19 |
+
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
|
20 |
text = text_splitter.split_documents(documents)
|
21 |
db = Chroma.from_documents(text, embedding)
|
22 |
+
llm = HuggingFaceHub(repo_id="OpenAssistant/oasst-sft-1-pythia-12b", model_kwargs={"temperature": 1.0, "max_length": 512})
|
23 |
global chain
|
24 |
chain = RetrievalQA.from_chain_type(llm=llm,chain_type="stuff",retriever=db.as_retriever())
|
25 |
return 'Document has successfully been loaded'
|