Gradio fn function errors right after 60 seconds

Always exactly after 60 seconds since execution, the function I pass to gradio.interface errors, and in the web console I get a JSON parsing error. I set enable_queue to True but that didn’t seem to change anything.

Here’s how I launch:

iface = gr.Interface(f, [
        minimum=20, maximum=512, default=30, label="max length"),
    gr.inputs.Dropdown(["GPT-J-6B", "GPT-2"], type="index", label="model"),
    gr.inputs.Textbox(lines=1, placeholder="xxxxxxxx", label="space verification key")

], outputs="text", title=title, examples=examples)

How can I prevent it timing out after 60 seconds every time the function takes long?

^as soon as that reaches 60, it errors

1 Like

You can see Is there a timeout (max runtime) for spaces? - #2 by Epoching or the Gradio docs. You need to set enable_queue to True for longer inference

  • enable_queue (bool) - if True, inference requests will be served through a queue instead of with parallel threads. Required for longer inference times (> 1min) to prevent timeout.

yeah, key thing was I had to use enable=True within interface(...), not within an interface.launch call.

1 Like

Yes, this is an issue that we’re dealing with (Investigate enable_queue · Issue #431 · gradio-app/gradio ( Thanks for bringing it to our attention.

1 Like

As of the latest version of Gradio (2.6.0), this should be fixed. But please let me know if you still are running into issues @un-index

1 Like

I got it per this comment, thanks