I am trying to link a process with the progress bar...not finding solution anywhere. The only thing I could find was the below code...but I want to link a background process to the progress bar. Please help.
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
progress = html.Div(
[
dcc.Interval(id="progress-interval", n_intervals=0, interval=500),
dbc.Progress(id="progress"),
]
)
@app.callback(
[Output("progress", "value"), Output("progress", "children")],
[Input("progress-interval", "n_intervals")],
)
def update_progress(n):
# check progress of some background process, in this example we'll just
# use n_intervals constrained to be in 0-100
progress = min(n % 110, 100)
# only add text after 5% progress to ensure text isn't squashed too much
return progress, f"{progress} %" if progress >= 5 else ""