waloneai commited on
Commit
cc94f1d
·
verified ·
1 Parent(s): 4ffef74

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
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
- print(all_files)
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
- docs.add(d.name)
 
 
 
 
 
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(