Spaces:
Sleeping
Sleeping
Update file_processing.py
Browse files- file_processing.py +2 -2
file_processing.py
CHANGED
@@ -8,7 +8,7 @@ from dotenv import load_dotenv
|
|
8 |
# load_dotenv(r'C:\Users\sksha\Desktop\llm-assignment-master\llm-assignment-master\llm-assignment-master_\backend\.env')
|
9 |
openai_api_key = os.environ.get('OPENAI_API_KEY')
|
10 |
from langchain.document_loaders import TextLoader, PDFMinerLoader, UnstructuredWordDocumentLoader, CSVLoader
|
11 |
-
from langchain_community.document_loaders import PyMuPDFLoader,TextLoader,CSVLoader,Docx2txtLoader
|
12 |
|
13 |
# def load_documents(file_path):
|
14 |
# if file_path.endswith('.txt'):
|
@@ -38,7 +38,7 @@ def read_pdf(file_path: str) -> str:
|
|
38 |
return text
|
39 |
|
40 |
def read_docx(file_path: str) -> str:
|
41 |
-
loader=
|
42 |
text=loader.load()
|
43 |
return text
|
44 |
|
|
|
8 |
# load_dotenv(r'C:\Users\sksha\Desktop\llm-assignment-master\llm-assignment-master\llm-assignment-master_\backend\.env')
|
9 |
openai_api_key = os.environ.get('OPENAI_API_KEY')
|
10 |
from langchain.document_loaders import TextLoader, PDFMinerLoader, UnstructuredWordDocumentLoader, CSVLoader
|
11 |
+
from langchain_community.document_loaders import PyMuPDFLoader,TextLoader,CSVLoader,Docx2txtLoader,UnstructuredWordDocumentLoader
|
12 |
|
13 |
# def load_documents(file_path):
|
14 |
# if file_path.endswith('.txt'):
|
|
|
38 |
return text
|
39 |
|
40 |
def read_docx(file_path: str) -> str:
|
41 |
+
loader=UnstructuredWordDocumentLoader(file_path)
|
42 |
text=loader.load()
|
43 |
return text
|
44 |
|