Spaces:
Sleeping
Sleeping
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 = "./" + f
|
| 27 |
loader = PyPDFLoader(pdf_path)
|
| 28 |
docs.extend(loader.load())
|
| 29 |
elif f.endswith('.docx') or f.endswith('.doc'):
|
| 30 |
-
doc_path = "./" + f
|
| 31 |
loader = Docx2txtLoader(doc_path)
|
| 32 |
docs.extend(loader.load())
|
| 33 |
elif f.endswith('.txt'):
|
| 34 |
-
text_path = "./" + f
|
| 35 |
loader = TextLoader(text_path)
|
| 36 |
docs.extend(loader.load())
|
| 37 |
|
|
@@ -78,4 +78,4 @@ with gr.Blocks() as demo:
|
|
| 78 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False)
|
| 79 |
clear.click(lambda: None, None, chatbot, queue=False)
|
| 80 |
|
| 81 |
-
demo.launch(debug=True)
|
|
|
|
| 21 |
|
| 22 |
docs = []
|
| 23 |
|
| 24 |
+
for f in os.listdir("input/multiple_docs"):
|
| 25 |
if f.endswith(".pdf"):
|
| 26 |
+
pdf_path = "./input/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 = "./input/multiple_docs/" + f
|
| 31 |
loader = Docx2txtLoader(doc_path)
|
| 32 |
docs.extend(loader.load())
|
| 33 |
elif f.endswith('.txt'):
|
| 34 |
+
text_path = "./input/multiple_docs/" + f
|
| 35 |
loader = TextLoader(text_path)
|
| 36 |
docs.extend(loader.load())
|
| 37 |
|
|
|
|
| 78 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False)
|
| 79 |
clear.click(lambda: None, None, chatbot, queue=False)
|
| 80 |
|
| 81 |
+
demo.launch(debug=True)
|