Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Unsupported input type #8

Open
mldljyh opened this issue Mar 28, 2023 · 5 comments
Open

TypeError: Unsupported input type #8

mldljyh opened this issue Mar 28, 2023 · 5 comments

Comments

@mldljyh
Copy link

mldljyh commented Mar 28, 2023

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
Copy link

boyalp commented Mar 28, 2023

me too

@talkingwallace
Copy link
Owner

I ll check this problem, thanks for feedback

@ssoro
Copy link

ssoro commented Mar 31, 2023

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

@Jeremy-Niu
Copy link

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

@ThePaperFish
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants