talkingwallace/ChatGPT-Paper-Reader

TypeError: Unsupported input type

mldljyh opened this issue · 5 comments

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.

me too

I ll check this problem, thanks for feedback

ssoro commented

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

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

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)