Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,17 +21,17 @@ os.environ["OPENAI_API_KEY"] = os.getenv("OPENAPIKEY")
|
|
| 21 |
|
| 22 |
docs = []
|
| 23 |
|
| 24 |
-
for f in os.listdir("
|
| 25 |
if f.endswith(".pdf"):
|
| 26 |
-
pdf_path = "./
|
| 27 |
loader = PyPDFLoader(pdf_path)
|
| 28 |
docs.extend(loader.load())
|
| 29 |
elif f.endswith('.docx') or f.endswith('.doc'):
|
| 30 |
-
doc_path = "./
|
| 31 |
loader = Docx2txtLoader(doc_path)
|
| 32 |
docs.extend(loader.load())
|
| 33 |
elif f.endswith('.txt'):
|
| 34 |
-
text_path = "./
|
| 35 |
loader = TextLoader(text_path)
|
| 36 |
docs.extend(loader.load())
|
| 37 |
|
|
|
|
| 21 |
|
| 22 |
docs = []
|
| 23 |
|
| 24 |
+
for f in os.listdir("multiple_docs"):
|
| 25 |
if f.endswith(".pdf"):
|
| 26 |
+
pdf_path = "./multiple_docs/" + f
|
| 27 |
loader = PyPDFLoader(pdf_path)
|
| 28 |
docs.extend(loader.load())
|
| 29 |
elif f.endswith('.docx') or f.endswith('.doc'):
|
| 30 |
+
doc_path = "./multiple_docs/" + f
|
| 31 |
loader = Docx2txtLoader(doc_path)
|
| 32 |
docs.extend(loader.load())
|
| 33 |
elif f.endswith('.txt'):
|
| 34 |
+
text_path = "./multiple_docs/" + f
|
| 35 |
loader = TextLoader(text_path)
|
| 36 |
docs.extend(loader.load())
|
| 37 |
|