gradio: 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?

  • 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

Screenshot 2023-04-17 at 11 41 08

Logs

n/a

System Info

Gradio: 3.27.0
Google Colab ipynb

Severity

annoying

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 20 (3 by maintainers)

Most upvoted comments

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.

Thanks @chakrateja70 debug = True worked… In my case the issue was in the function.