mukulpatnaik/researchgpt

KeyError: 'text'

HWB426 opened this issue · 3 comments

Traceback (most recent call last):
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3802, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'text'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask/app.py", line 2551, in call
return self.wsgi_app(environ, start_response)
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask/app.py", line 2531, in wsgi_app
response = self.handle_exception(e)
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/Users/tom/Downloads/researchgpt/main-local.py", line 158, in process_pdf
df = chatbot.paper_df(paper_text)
File "/Users/tom/Downloads/researchgpt/main-local.py", line 81, in paper_df
df['length'] = df['text'].apply(lambda x: len(x))
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/pandas/core/frame.py", line 3807, in getitem
indexer = self.columns.get_loc(key)
File "/Users/tom/miniconda3/envs/researchgpt-main/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3804, in get_loc
raise KeyError(key) from err
KeyError: 'text'

I've got the same problem.

+1

Your pdf file is obtained by scanning, and the program cannot extract the text information, which leads to this error