NaimaAqeel commited on
Commit
651c0eb
·
verified ·
1 Parent(s): d101c30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -82,12 +82,12 @@ def upload_files(files):
82
  try:
83
  for file in files:
84
  file_name = file.name
85
-
86
- # Extract file content
87
  if file_name.endswith('.pdf'):
88
- text = extract_text_from_pdf(file.read())
89
  elif file_name.endswith('.docx'):
90
- text = extract_text_from_docx(file.read())
91
  else:
92
  return {"error": "Unsupported file format"}
93
 
 
82
  try:
83
  for file in files:
84
  file_name = file.name
85
+ file_content = file.getvalue() # Get the file content as bytes
86
+
87
  if file_name.endswith('.pdf'):
88
+ text = extract_text_from_pdf(file_content)
89
  elif file_name.endswith('.docx'):
90
+ text = extract_text_from_docx(file_content)
91
  else:
92
  return {"error": "Unsupported file format"}
93