Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ import accelerate
|
|
| 24 |
#Set parameters
|
| 25 |
|
| 26 |
llm_model = 'mistralai/Mixtral-8x7B-Instruct-v0.1'
|
| 27 |
-
|
| 28 |
chunk_size = 1024
|
| 29 |
chunk_overlap = 128
|
| 30 |
temperature = 0.1
|
|
@@ -35,7 +35,7 @@ def load_doc(list_file_path, chunk_size, chunk_overlap):
|
|
| 35 |
# Processing for one document only
|
| 36 |
# loader = PyPDFLoader(file_path)
|
| 37 |
# pages = loader.load()
|
| 38 |
-
loaders = [PyPDFLoader(
|
| 39 |
pages = []
|
| 40 |
for loader in loaders:
|
| 41 |
pages.extend(loader.load())
|
|
@@ -95,7 +95,7 @@ def initialize_llmchain(vector_db):
|
|
| 95 |
def initialize_database(list_file_obj):
|
| 96 |
# Create list of documents (when valid)
|
| 97 |
#list_file_path = [x.name for x in list_file_obj if x is not None]
|
| 98 |
-
list_file_path = os.listdir(
|
| 99 |
# Create collection_name for vector database
|
| 100 |
collection_name = Path(list_file_path[0]).stem
|
| 101 |
# Fix potential issues from naming convention
|
|
|
|
| 24 |
#Set parameters
|
| 25 |
|
| 26 |
llm_model = 'mistralai/Mixtral-8x7B-Instruct-v0.1'
|
| 27 |
+
list_file_obj = '/home/user/app/pdfs/'
|
| 28 |
chunk_size = 1024
|
| 29 |
chunk_overlap = 128
|
| 30 |
temperature = 0.1
|
|
|
|
| 35 |
# Processing for one document only
|
| 36 |
# loader = PyPDFLoader(file_path)
|
| 37 |
# pages = loader.load()
|
| 38 |
+
loaders = [PyPDFLoader(list_file_obj+x) for x in list_file_path]
|
| 39 |
pages = []
|
| 40 |
for loader in loaders:
|
| 41 |
pages.extend(loader.load())
|
|
|
|
| 95 |
def initialize_database(list_file_obj):
|
| 96 |
# Create list of documents (when valid)
|
| 97 |
#list_file_path = [x.name for x in list_file_obj if x is not None]
|
| 98 |
+
list_file_path = os.listdir(list_file_obj)
|
| 99 |
# Create collection_name for vector database
|
| 100 |
collection_name = Path(list_file_path[0]).stem
|
| 101 |
# Fix potential issues from naming convention
|