Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,12 +47,12 @@ Answer:
|
|
| 47 |
|
| 48 |
# ---------------- FILE LOADER ----------------
|
| 49 |
def load_any(path: str):
|
| 50 |
-
|
| 51 |
-
if
|
| 52 |
return PyPDFLoader(path).load()
|
| 53 |
-
if
|
| 54 |
return TextLoader(path, encoding="utf-8").load()
|
| 55 |
-
if
|
| 56 |
return Docx2txtLoader(path).load()
|
| 57 |
return []
|
| 58 |
|
|
|
|
| 47 |
|
| 48 |
# ---------------- FILE LOADER ----------------
|
| 49 |
def load_any(path: str):
|
| 50 |
+
p = path.lower()
|
| 51 |
+
if p.endswith(".pdf"):
|
| 52 |
return PyPDFLoader(path).load()
|
| 53 |
+
if p.endswith(".txt"):
|
| 54 |
return TextLoader(path, encoding="utf-8").load()
|
| 55 |
+
if p.endswith(".docx"):
|
| 56 |
return Docx2txtLoader(path).load()
|
| 57 |
return []
|
| 58 |
|