mikeion commited on
Commit
3de5822
·
1 Parent(s): e0fb9c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -107,7 +107,10 @@ class Chatbot():
107
  print('Creating dataframe')
108
  filtered_pdf= []
109
  for row in pdf:
110
- if len(row['text']) < 30:
 
 
 
111
  continue
112
  filtered_pdf.append(row)
113
  df = pd.DataFrame(filtered_pdf)
 
107
  print('Creating dataframe')
108
  filtered_pdf= []
109
  for row in pdf:
110
+ # This will use the get method to safely access the 'text' key in the row dictionary,
111
+ # and if the key is not present, it will use an empty string as a default value. This
112
+ # should prevent a KeyError from occurring.
113
+ if len(row.get('text', '')) < 30:
114
  continue
115
  filtered_pdf.append(row)
116
  df = pd.DataFrame(filtered_pdf)