Shreyas094 commited on
Commit
a957e4b
1 Parent(s): b789218

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -100,6 +100,9 @@ def update_vectors(files, parser):
100
  logging.info(f"Processing file: {file.name}")
101
  try:
102
  data = load_document(file, parser)
 
 
 
103
  logging.info(f"Loaded {len(data)} chunks from {file.name}")
104
  all_data.extend(data)
105
  total_chunks += len(data)
@@ -113,6 +116,10 @@ def update_vectors(files, parser):
113
 
114
  logging.info(f"Total chunks processed: {total_chunks}")
115
 
 
 
 
 
116
  try:
117
  if os.path.exists("faiss_database"):
118
  logging.info("Updating existing FAISS database")
 
100
  logging.info(f"Processing file: {file.name}")
101
  try:
102
  data = load_document(file, parser)
103
+ if not data:
104
+ logging.warning(f"No chunks loaded from {file.name}")
105
+ continue
106
  logging.info(f"Loaded {len(data)} chunks from {file.name}")
107
  all_data.extend(data)
108
  total_chunks += len(data)
 
116
 
117
  logging.info(f"Total chunks processed: {total_chunks}")
118
 
119
+ if not all_data:
120
+ logging.warning("No valid data extracted from uploaded files")
121
+ return "No valid data could be extracted from the uploaded files. Please check the file contents and try again.", display_documents()
122
+
123
  try:
124
  if os.path.exists("faiss_database"):
125
  logging.info("Updating existing FAISS database")