NaimaAqeel commited on
Commit
345774f
·
verified ·
1 Parent(s): 5eaad3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -84,15 +84,10 @@ def upload_files(files):
84
  file_name = file.name
85
 
86
  # Extract file content
87
- if isinstance(file, str):
88
- file_content = file
89
- else:
90
- file_content = file.read().decode("utf-8")
91
-
92
  if file_name.endswith('.pdf'):
93
- text = extract_text_from_pdf(file_content.encode())
94
  elif file_name.endswith('.docx'):
95
- text = extract_text_from_docx(file_content.encode())
96
  else:
97
  return {"error": "Unsupported file format"}
98
 
@@ -172,4 +167,3 @@ def main():
172
 
173
  if __name__ == "__main__":
174
  main()
175
-
 
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
 
 
167
 
168
  if __name__ == "__main__":
169
  main()