У меня есть код на Jupyter, который работает так:
You input a keyword
The code makes a couple of API calls based on the keyword
The code merges and wrangles the optained databases
The code plots with Plotly
Теперь я хотел бы выложить этот код в Интернете для своих коллег, но я никогда не использовал Dash. Пользователь должен только:
Use an input box
Press confirm
Obtain the graphs
Мне нужно сохранить входные данные как переменную, но как это сделать? Я следую этому примеру:
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
dcc.Input(id='my-id', value='initial value', type='text'),
html.Div(id='my-div')
])
@app.callback(
Output(component_id='my-div', component_property='children'),
[Input(component_id='my-id', component_property='value')]
)
def update_output_div(input_value):
return 'You\'ve entered "{}"'.format(input_value)
if __name__ == '__main__':
app.run_server(debug=True)
Можно ли сохранить значение из поля как переменную python? Спасибо