Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -107,7 +107,10 @@ class Chatbot():
|
|
107 |
print('Creating dataframe')
|
108 |
filtered_pdf= []
|
109 |
for row in pdf:
|
110 |
-
|
|
|
|
|
|
|
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)
|