Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -76,16 +76,11 @@ else:
|
|
76 |
def upload_files(files):
|
77 |
global index, document_texts
|
78 |
try:
|
79 |
-
for
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
text = extract_text_from_pdf("temp.pdf")
|
85 |
-
elif file.name.endswith('.docx'):
|
86 |
-
with open("temp.docx", "wb") as f:
|
87 |
-
f.write(content)
|
88 |
-
text = extract_text_from_docx("temp.docx")
|
89 |
else:
|
90 |
return "Unsupported file format"
|
91 |
|
@@ -148,6 +143,7 @@ demo.launch()
|
|
148 |
|
149 |
|
150 |
|
|
|
151 |
|
152 |
|
153 |
|
|
|
76 |
def upload_files(files):
|
77 |
global index, document_texts
|
78 |
try:
|
79 |
+
for file_path in files:
|
80 |
+
if file_path.endswith('.pdf'):
|
81 |
+
text = extract_text_from_pdf(file_path)
|
82 |
+
elif file_path.endswith('.docx'):
|
83 |
+
text = extract_text_from_docx(file_path)
|
|
|
|
|
|
|
|
|
|
|
84 |
else:
|
85 |
return "Unsupported file format"
|
86 |
|
|
|
143 |
|
144 |
|
145 |
|
146 |
+
|
147 |
|
148 |
|
149 |
|