Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def run(uploaded_files):
|
|
31 |
for file in uploaded_files:
|
32 |
if file.name.endswith('.pdf'):
|
33 |
all_files.append(file.name)
|
34 |
-
|
35 |
return all_files
|
36 |
|
37 |
def createAnswer(files, designation):
|
@@ -40,7 +40,12 @@ def createAnswer(files, designation):
|
|
40 |
|
41 |
# Add the uploaded files to the Docs object
|
42 |
for d in files:
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# Query the documents to find the best candidate for the given designation
|
46 |
answer = docs.query(
|
|
|
31 |
for file in uploaded_files:
|
32 |
if file.name.endswith('.pdf'):
|
33 |
all_files.append(file.name)
|
34 |
+
print(f"File uploaded: {file.name}, Size: {file.size} bytes")
|
35 |
return all_files
|
36 |
|
37 |
def createAnswer(files, designation):
|
|
|
40 |
|
41 |
# Add the uploaded files to the Docs object
|
42 |
for d in files:
|
43 |
+
try:
|
44 |
+
docs.add(d.name)
|
45 |
+
print(f"Successfully added file: {d.name}")
|
46 |
+
except Exception as e:
|
47 |
+
print(f"Error adding file {d.name}: {e}")
|
48 |
+
return f"Error reading file {d.name}. Please ensure the file is not empty or corrupted."
|
49 |
|
50 |
# Query the documents to find the best candidate for the given designation
|
51 |
answer = docs.query(
|