talkingwallace / ChatGPT-Paper-Reader

This repo offers a simple interface that helps you to read&summerize research papers in pdf format. You can ask some questions after reading. This interface is developed based on openai API and using GPT-3.5-turbo model.
739 stars 110 forks source link

TypeError: Unsupported input type #8

Open mldljyh opened 1 year ago

mldljyh commented 1 year ago

When I ran the GUI version of this Python code and selected alexnet.pdf as an example to analyze, I got the following error:

File "/opt/homebrew/lib/python3.10/site-packages/pdfminer/utils.py", line 59, in init raise TypeError("Unsupported input type: %s" % type(filename)) TypeError: Unsupported input type: <class 'tempfile._TemporaryFileWrapper'>"

My Gradio version is 3.15.0.

boyalp commented 1 year ago

me too

talkingwallace commented 1 year ago

I ll check this problem, thanks for feedback

ssoro commented 1 year ago

me too. raise TypeError("Unsupported input type: %s" % type(filename)) TypeError: Unsupported input type: <class 'tempfile._TemporaryFileWrapper'>

Jeremy-Niu commented 1 year ago

the same issue raise TypeError("Unsupported input type: %s" % type(filename)) TypeError: Unsupported input type: <class 'tempfile._TemporaryFileWrapper'>

ThePaperFish commented 1 year ago

Looks like the output of gr.File is providing tempfile._TemporaryFileWrapper object, but the Paper object requiring str path.

I changed line 14 of gui.py to pdf_file.name then the code is able to run now.

    def analyse(self, api_key, pdf_file):
        self.session = PaperReader(api_key)
        self.paper = Paper(pdf_file.name)  # change here
        return self.session.summarize(self.paper)