Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
87 |
if file_name.endswith('.pdf'):
|
88 |
-
text = extract_text_from_pdf(
|
89 |
elif file_name.endswith('.docx'):
|
90 |
-
text = extract_text_from_docx(
|
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 |
|