ZeroGPU quota issue

#38
by hysts HF staff - opened

Hi @lllyasviel ,
Would it be possible to upgrade the SDK version of this Space to the latest gradio==5.13.1?

In gradio<5.12.0, there was an issue where the ZeroGPU quota was not handled correctly. Though logged-in users have a 5-minute GPU quota, and PRO users have a 25-minute quota, when a function directly called by an event trigger in Gradio is not decorated with @spaces.GPU, all users are treated as non-logged-in users, resulting in only a 3-minute quota for everyone.

This issue was addressed in gradio==5.12.0, so upgrading to the latest version would improve the user experience of your Space.

Since the code is hidden, I'm not sure if your code is compatible with gradio 5.x, but if there's a compatibility issue, you can resolve the ZeroGPU quota issue by adding the attribute .zerogpu = True to the function called by the event trigger instead.

For example, this code doesn't work with gradio<5.12.0,

import gradio as gr
import spaces


@spaces.GPU(duration=181)
def inner_fn():
    return "test"


def wrapper_fn():
    return inner_fn()


with gr.Blocks() as demo:
    btn = gr.Button()
    out = gr.Textbox()
    btn.click(fn=wrapper_fn, outputs=out)
demo.launch()

but you can fix it by adding wrapper_fn.zerogpu = True like this:

import gradio as gr
import spaces


@spaces.GPU(duration=181)
def inner_fn():
    return "test"


def wrapper_fn():
    return inner_fn()


wrapper_fn.zerogpu = True


with gr.Blocks() as demo:
    btn = gr.Button()
    out = gr.Textbox()
    btn.click(fn=wrapper_fn, outputs=out)
demo.launch()

i see. will try to take some actions

I got limited quota plzz I need to do more images it very good

Sign up or log in to comment