Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bokeh.models.widgets import FileInput
- div = Div(text='<div id="document-container10"></div>', width=500, height=500)
- l = FileInput(accept='.json')
- l.js_on_change('value', CustomJS(code="""
- function b64DecodeUnicode(str) {
- return decodeURIComponent(atob(str).split('').map(function(c) {
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
- }).join(''));
- }
- const {Document} = Bokeh.require('document/document');
- const data = JSON.parse(b64DecodeUnicode(cb_obj.value));
- const doc = Document.from_json_string(data);
- Bokeh.embed.add_document_standalone(doc, document.getElementById('document-container10'), [], true);
- cb_obj.disabled = true;
- """))
- show(column(l, div))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement