Hi,
I am a bioinformatician with intermediate knowledge of Python. I am relatively new to dash.
I already have a python program which takes 3 arguments - 2 files and one integer and processes something from the files based on the integer value. I wish to make this available online so that it is accessible across the internet. I know this is possible using python dash.
As a starting point, what I wish to just have a drag and drop UI from which user can browse and upload the file. And now I just want to provide that file to my already created program. It does not work. Right now I just wish that the uploaded file’s name prints in the console.
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
dcc.Upload(
id='upload-data',
children=html.Div([
'Drag and Drop or ',
html.A('Select Files')
]),
style={
'width': '50%',
'height': '60px',
'lineHeight': '60px',
'borderWidth': '1px',
'borderStyle': 'dashed',
'borderRadius': '5px',
'textAlign': 'center',
'margin': '10px'
},
# Allow multiple files to be uploaded
multiple=True
),
html.Div(id='output-data-upload')
])
@app.callback(Output('upload-data'),
[
Input('upload-data'),
])
def parse_data(input_data):
file=output-data-upload
print "filename is ", file
if __name__ == '__main__':
app.run_server(debug=True)