gradio
gradio copied to clipboard
raising `gr.Error` gives "Unexpected end of JSON input" in Colab notebooks
Describe the bug
raising the error is supposed to show a modal with the custom error message
instead the error modal says "Unexpected end of JSON input"
Is there an existing issue for this?
- [X] I have searched the existing issues
Reproduction
import gradio as gr
def welcome(name):
if name == "WTF":
raise gr.Error("It doesn't work")
return f"Welcome to Gradio, {name}!"
with gr.Blocks() as demo:
gr.Markdown(
"""
# Hello World!
Start typing below to see the output.
""")
inp = gr.Textbox(placeholder="What is your name?")
out = gr.Textbox()
inp.submit(welcome, inp, out)
if __name__ == "__main__":
demo.launch()
Screenshot
Logs
n/a
System Info
Gradio: 3.27.0
Google Colab ipynb
Severity
annoying
I get the same thing if I raise ValueError
instead of gr.Error
the docs example for gr.Error
uses an Interface instead of Blocks... is this not supported in Blocks?
Hi @anentropic !
gr.Error works with blocks. I can only reproduce your error in colab, not locally. And setting a share link via share=True
removes the error.
Makes me think it is a colab-specific bug. We will look into it!
how should I fix this
I'm not sure what the underlying cause is yet. Seems to be an issue in colab? I would set share=True
since that is a workaround for now.
hi! seems that i found root cause for this issue, google colab proxy does not pass data for responses with 4xx / 5xx codes (more context here https://github.com/googlecolab/colabtools/issues/3308). it just returns 505 html page not json data of error.
here is example
.
not sure however how to fix it
Thank you for looking into this @tye-singwa ! Now that we know the likely root cause, we can ask colab support. I can take care of that.
Let's sit tight. Colab is working on a fix for this on their end.
Is it fixed by Colab?
Not yet as far as I know
Having the same issue
I'm also facing the same issue with google colab
iam also facing the same issue with gradio
issue cleared we have to signup with new email id which you have not used before in chatgpt then after we have to create api
Issue Resolved :
step : To view errors and logs, set debug=True
in launch()
~ You find error and try to slove it
~ error's like Incorrect API key.
~Expiration of credit score in OpenAi
If still not resolved, after above steps , set share=True
in launch()
issue cleared we have to signup with new email id which you have not used before in chatgpt then after we have to create api
will you please elaborate the process I an not able to do it
I'm also facing the same issue with google colab, How to fix it?
Thanks @chakrateja70
debug = True
worked... In my case the issue was in the function.
I'm also facing the same issue with google colab, How to fix it?
Check my comment above maybe it's helpful
Hi all, sorry the problem is with Google colab. I will follow up with them to see if they have a fix coming soon. I think setting share=True and clicking on the share link should make this go away.
Hi @freddyaboulton I'm also facing the same issue with Google Colab. Your last solution not working for me.
the problem is still...