gabacode / chatPDF

Load a PDF file and ask questions via llama_index and GPT
93 stars 35 forks source link

Can't read pdf file #7

Closed EZPK closed 1 year ago

EZPK commented 1 year ago

Hi guys,

I'm trying your stuff right now but got this error. I'm using your hacker manifesto pdf file. Any ideas ?

PS D:\Informatique\chatPDF> python main.py
'clear' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
📁 Select a file
1. file.pdf

Enter a number, or 0 to exit: 1
👀 Loading...
Traceback (most recent call last):
  File "D:\Informatique\chatPDF\main.py", line 71, in <module>
    ask(file)
  File "D:\Informatique\chatPDF\main.py", line 37, in ask
    PDFReader = download_loader("PDFReader")
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\llama_index\readers\download.py", line 125, in download_loader
    library = json.loads(library_raw_content)
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3)
gabacode commented 1 year ago

Hello @EZPK , thanks for bringing this up. I sent a fix and some updates, let me know how you get along with it. Cheers!

EZPK commented 1 year ago

Unfortunately, I pulled your updates but I've still got the same error:

👀 Loading...
Traceback (most recent call last):
  File "D:\Informatique\chatPDF\main.py", line 71, in <module>
    ask(file)
  File "D:\Informatique\chatPDF\main.py", line 37, in ask
    PDFReader = download_loader("PDFReader")
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\llama_index\readers\download.py", line 125, in download_loader
    library = json.loads(library_raw_content)
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3)

Any additionnal informations I can give you ?

gabacode commented 1 year ago

Unfortunately, I pulled your updates but I've still got the same error:

👀 Loading...
Traceback (most recent call last):
  File "D:\Informatique\chatPDF\main.py", line 71, in <module>
    ask(file)
  File "D:\Informatique\chatPDF\main.py", line 37, in ask
    PDFReader = download_loader("PDFReader")
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\llama_index\readers\download.py", line 125, in download_loader
    library = json.loads(library_raw_content)
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Thoma\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3)

Any additionnal informations I can give you ?

Yes, what's the version outputted for llama-index if you run pip show llama_index ?

EZPK commented 1 year ago

Here you are good sir:

PS D:\Informatique\chatPDF> pip show llama_index
Name: llama-index
Version: 0.5.12
Summary: Interface between LLMs and your data.
Home-page: https://github.com/jerryjliu/gpt_index
Author:
Author-email:
License: MIT
Location: c:\users\thoma\appdata\local\programs\python\python310\lib\site-packages
Requires: dataclasses_json, langchain, numpy, openai, pandas, tenacity, tiktoken
Required-by:

Thanks for checking my issue.

gabacode commented 1 year ago

This seems related to https://github.com/jerryjliu/llama_index/issues/4449 Please bear with me while I work on a fix in the next following days. Cheers!

SashvDave commented 1 year ago

Hey @gabacode, encountering the same issue. Were you able to find a fix?

mcquaas commented 1 year ago

Same here. Would love to try this out. Lots of good uses for it.

gabacode commented 1 year ago

Hello, kindly pull from main and upgrade packages with: pip install -r requirements.txt. Please let me know if that fixed it for you.

Cheers!

gabacode commented 1 year ago

Closing for now, feel free to reopen if needed!