Basic usage
To enable progress bars, add an argument to your function that has a default value of agr.Progress instance. Then you can update the progress levels by calling this instance directly with a float between 0 and 1.
- Start at 0% with the description “Starting”
- Update to 5% after a brief pause
- Show incremental progress with the description “Reversing” as it processes each letter
Using the tqdm method
TheProgress instance provides a tqdm() method that makes it easy to track progress over an iterable. This method works similarly to the popular tqdm library:
Automatic tqdm integration
If you use thetqdm library, you can even report progress updates automatically from any tqdm.tqdm that already exists within your function by setting the default argument as gr.Progress(track_tqdm=True):
Progress bar parameters
When calling theProgress instance, you can provide:
- Float value (0-1): The progress level as a decimal between 0 and 1
descparameter: A description string to display with the progress bar
Multi-step progress tracking
For complex operations with multiple stages, you can combine direct progress updates with thetqdm() method:
Progress bars provide valuable feedback to users during long-running operations, improving the overall user experience of your Gradio app.