> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/gradio-app/gradio/llms.txt
> Use this file to discover all available pages before exploring further.

# Progress

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

## Constructor

```python theme={null}
gr.Progress(track_tqdm=False)
```

### Parameters

<ParamField path="track_tqdm" type="bool" default="False">
  If True, the Progress object will track any tqdm.tqdm iterations with the tqdm library in the function.
</ParamField>

## Methods

### **call**

```python theme={null}
progress(progress, desc=None, total=None, unit="steps")
```

Updates progress tracker with progress and message text.

<ParamField path="progress" type="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.
</ParamField>

<ParamField path="desc" type="str | None" default="None">
  Description to display.
</ParamField>

<ParamField path="total" type="int | float | None" default="None">
  Estimated total number of steps.
</ParamField>

<ParamField path="unit" type="str" default="'steps'">
  Unit of iterations.
</ParamField>

### tqdm

```python theme={null}
progress.tqdm(iterable, desc=None, total=None, unit="steps")
```

Attaches progress tracker to iterable, like tqdm.

<ParamField path="iterable" type="Iterable | None">
  Iterable to attach progress tracker to.
</ParamField>

<ParamField path="desc" type="str | None" default="None">
  Description to display.
</ParamField>

<ParamField path="total" type="int | float | None" default="None">
  Estimated total number of steps.
</ParamField>

<ParamField path="unit" type="str" default="'steps'">
  Unit of iterations.
</ParamField>

### update

```python theme={null}
progress.update(n=1)
```

Increases latest iterable with specified number of steps.

<ParamField path="n" type="int | float" default="1">
  Number of steps completed.
</ParamField>

## Examples

### Basic Progress

```python theme={null}
import gradio as gr
import time

def my_function(x, progress=gr.Progress()):
    progress(0, desc="Starting...")
    time.sleep(1)
    for i in progress.tqdm(range(100)):
        time.sleep(0.1)
    return x

gr.Interface(my_function, gr.Textbox(), gr.Textbox()).launch()
```

### Progress with Steps

```python theme={null}
import gradio as gr
import time

def process_data(data, progress=gr.Progress()):
    # Update with tuple (current, total)
    for i in range(10):
        progress((i, 10), desc=f"Processing step {i+1}/10")
        time.sleep(0.5)
    return "Done!"

with gr.Blocks() as demo:
    input_text = gr.Textbox()
    output_text = gr.Textbox()
    btn = gr.Button("Process")
    btn.click(process_data, input_text, output_text)

demo.launch()
```

### Progress with tqdm

```python theme={null}
import gradio as gr
import time

def long_running_task(progress=gr.Progress(track_tqdm=True)):
    import tqdm
    results = []
    for i in tqdm.tqdm(range(100), desc="Processing"):
        time.sleep(0.1)
        results.append(i * 2)
    return sum(results)

with gr.Blocks() as demo:
    output = gr.Number()
    btn = gr.Button("Run")
    btn.click(long_running_task, None, output)

demo.launch()
```

## 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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.