import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id='input-field', type='text', value=''),
html.Button('Submit', id='submit-button', n_clicks=0),
html.Div(id='output-div')
]
)
@app.callback(
Output('output-div', 'children'),
Input('submit-button', 'n_clicks'),
State('input-field', 'value')
)
def process_input(n_clicks, input_value):
# Perform some operations with the input value
result = do_something(input_value)
return result
@app.callback(
Output('output-div', process_input()),
Input('output-div', 'children')
)
def process_output(input_value):
# Use the output of the previous callback as input for this callback
processed_result = do_something_else(input_value)
return processed_result
def do_something(value):
# Perform some operations with the input value
return value.upper()
def do_something_else(value):
# Perform some other operations with the input value
return f"Processed: {value}"
if __name__ == '__main__':
app.run_server(debug=True)
I want to pass the output came from previous callback as input of the app.callback() funtion like I’m writing example under the question