jupyter-dash
jupyter-dash copied to clipboard
Deploying JupyterDash in Google Collab, callbacks not functioning correctly
!pip install jupyter-dash
!pip install dash_uploader
app = JupyterDash(__name__)
app.config.suppress_callback_exceptions = True
du.configure_upload(app, r"C:\tmp\Uploads")
app.layout = html.Div([
html.Div(
dcc.Graph(id="output-data-upload",
config = {'toImageButtonOptions':
{'width': None,
'height': None,
'format': 'png',
'filename': 'Image_Graph'}
})
),
html.Div(
du.Upload(
id='dash-uploader',
text='Drag or Drop file here',
text_completed='Completed: ',
pause_button=True,
cancel_button=True,
max_file_size=1e+9, # 1gb
filetypes=["mp4","mkv","avi"],
upload_id=uuid.uuid1()
),
id="upload-container"),
html.Div(
html.Button('Continue', id='continue', n_clicks=0,style={"display":"None"})
,style={"margin":"auto","position":"absolute","right":10,"bottom":10})
])
@app.callback(
[Output('output-data-upload', 'figure'), Output('continue', 'style'), Output('upload-container', 'style')],
[Input('dash-uploader', 'isCompleted'), Input('continue', 'n_clicks')],
[State('dash-uploader', 'fileNames'), State('dash-uploader', 'upload_id')]
)
def update_output(iscompleted, conbut, list_of_contents, upload_id):
print(upload_id)
app.run_server(mode="external", port=port, debug=True)
I am running a jupyter notebook file in google colab, and regardless of what I run inside of the callback function, I get a callback error:
Callback error updating output-data-upload.figure, continue.style, upload-container.style
This leads me to believe the callback function is not registering properly. I have tried reducing the callback function's inputs, outputs, and states to a minimum, but the error persists for me. I can see my graph online, but once I upload something, I get that error.
I am unsure if this is a bug or an error on my accord, but from what I search online this functionality should be enabled.
I am also facing a similar situation. Did you solve this?
I am also facing a similar situation. Did you solve this?
Nope, ended up remaking my app in IPywidgets and using another file upload package. Running Dash in a colab file did not work at all for me.