Spaces:
Sleeping
Sleeping
ShivanshMathur007
commited on
Commit
•
0428475
1
Parent(s):
179fb88
Update app.py
Browse files
app.py
CHANGED
@@ -23,14 +23,14 @@ def MOP(path):
|
|
23 |
docs=[]
|
24 |
loader = PyPDFDirectoryLoader(path)
|
25 |
docs = loader.load()
|
26 |
-
text_splitter = RecursiveCharacterTextSplitter(chunk_size=
|
27 |
text_chunks = text_splitter.split_documents(docs)
|
28 |
embeddings = HuggingFaceEmbeddings(model_name="thenlper/gte-base")
|
29 |
vector_store = FAISS.from_documents(text_chunks, embedding=embeddings)
|
30 |
filename_to_keep = 'Dummy_standard MoP_template_new.pdf'
|
31 |
prompt_file=delete_files_except(filename_to_keep,path)
|
32 |
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1"
|
33 |
-
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature": 0.1, "max_new_tokens":
|
34 |
retriever = vector_store.as_retriever(search_type="similarity",search_kwargs={"k": len(text_chunks)})
|
35 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever,verbose=True)
|
36 |
message= f"""<s> [INST] You have two documents:
|
|
|
23 |
docs=[]
|
24 |
loader = PyPDFDirectoryLoader(path)
|
25 |
docs = loader.load()
|
26 |
+
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000 , chunk_overlap=500)
|
27 |
text_chunks = text_splitter.split_documents(docs)
|
28 |
embeddings = HuggingFaceEmbeddings(model_name="thenlper/gte-base")
|
29 |
vector_store = FAISS.from_documents(text_chunks, embedding=embeddings)
|
30 |
filename_to_keep = 'Dummy_standard MoP_template_new.pdf'
|
31 |
prompt_file=delete_files_except(filename_to_keep,path)
|
32 |
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1"
|
33 |
+
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature": 0.1, "max_new_tokens": 2048})
|
34 |
retriever = vector_store.as_retriever(search_type="similarity",search_kwargs={"k": len(text_chunks)})
|
35 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever,verbose=True)
|
36 |
message= f"""<s> [INST] You have two documents:
|