How to know if I'm in a queue programatically when calling client via API?

When I run a prediction from an Space via API, I do this:

result = client.predict(imagenSource, imagenDestiny, api_name="/predict")

After completition it returns either the result or an error. It’s Ok.

But, how can I know in that moment is I’m in a queue or if it is processing? Would be great to know so I can handle that on my side.

Maybe it’s something very easy, but I’m new to gradio and I didn’t found anything at the docs.

Thanks in advance.

1 Like