DJHumanRPT commited on
Commit
60845b9
·
verified ·
1 Parent(s): 11ceb90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -58,7 +58,12 @@ def parse_documents(uploaded_files):
58
  for file in uploaded_files:
59
  try:
60
  file_type = file.name.split(".")[-1].lower()
61
- if file_type in ["pdf", "txt", "docx", "html"]:
 
 
 
 
 
62
  # Create a temporary file with the correct extension
63
  with tempfile.NamedTemporaryFile(
64
  delete=False, suffix=f".{file_type}"
 
58
  for file in uploaded_files:
59
  try:
60
  file_type = file.name.split(".")[-1].lower()
61
+
62
+ # Handle text files directly
63
+ if file_type == "txt":
64
+ content += file.getvalue().decode("utf-8")
65
+ # Use converter for other supported file types
66
+ elif file_type in ["pdf", "docx", "html"]:
67
  # Create a temporary file with the correct extension
68
  with tempfile.NamedTemporaryFile(
69
  delete=False, suffix=f".{file_type}"