Skip to main content
The Progress class provides a custom progress tracker that can be used in Gradio functions to display progress updates to users.

Constructor

Parameters

bool
default:"False"
If True, the Progress object will track any tqdm.tqdm iterations with the tqdm library in the function.

Methods

call

Updates progress tracker with progress and message text.
float | tuple[int, int | None] | None
If float, should be between 0 and 1 representing completion. If tuple, first number represents steps completed, and second value represents total steps or None if unknown. If None, hides progress bar.
str | None
default:"None"
Description to display.
int | float | None
default:"None"
Estimated total number of steps.
str
default:"'steps'"
Unit of iterations.

tqdm

Attaches progress tracker to iterable, like tqdm.
Iterable | None
Iterable to attach progress tracker to.
str | None
default:"None"
Description to display.
int | float | None
default:"None"
Estimated total number of steps.
str
default:"'steps'"
Unit of iterations.

update

Increases latest iterable with specified number of steps.
int | float
default:"1"
Number of steps completed.

Examples

Basic Progress

Progress with Steps

Progress with tqdm

Notes

  • To attach a Progress tracker to a function, add a parameter right after the input parameters that has a default value set to a gr.Progress() instance
  • The Progress tracker automatically appears in the Gradio UI when the function is running
  • You can use either the functional style (calling progress()) or the tqdm-like style (using progress.tqdm())
  • Progress updates are displayed in real-time to users