Strange issue related to gr.File() component

I am using gradio version 3.11.0

I have an input component where I am expecting a PDF file. I have specified type=‘binary’. Code is below.
input_pdf = gr.File(type="binary", label="Input Invoice PDF file")

I am getting below runtime error with type=‘binary’

ValueError: Unknown type: binary. Please choose from: ‘file’, ‘bytes’.

I changed the type to ‘bytes’ thinking ‘binary’ might be a wrong keyword. But this time I got error at the code line itself, it complained to use ‘bytes’ and suprisingly error says to choose from [‘file’, ‘binary’]. You can see below:

NOTE: I am running this in google colab with python version 3.10.11

I am stuck please help. I have tried upgrading to the latest releases but it’s raising a different error related to ‘toorjson’ not found in some other lib in gradio.

hi @shubh1608 .

Could you please upgrade your Gradio to 3.30.0 and use File type="binary" ?


Hey @radames , I will try upgrading the gradio. Thanks for the reply.

1 Like