faiz0983 commited on
Commit
b2a3594
·
verified ·
1 Parent(s): e90b7cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -47,12 +47,12 @@ Answer:
47
 
48
  # ---------------- FILE LOADER ----------------
49
  def load_any(path: str):
50
- path = path.lower()
51
- if path.endswith(".pdf"):
52
  return PyPDFLoader(path).load()
53
- if path.endswith(".txt"):
54
  return TextLoader(path, encoding="utf-8").load()
55
- if path.endswith(".docx"):
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