Ejemplo n.º 1
0
def get_upload_component(id):
    return du.Upload(
        id=id,
        max_file_size=1800,  # 1800 Mb
        filetypes=['pk'],
        upload_id=uuid.uuid1(),  # Unique session id
    )
Ejemplo n.º 2
0
 def get_upload_component(id):
     settings.requests_pathname_prefix = APP_ROOT
     return du.Upload(
         id=id,
         max_file_size=1800,  # 1800 Mb
         filetypes=['csv', 'zip', 'cio'],
         upload_id=upload_id,  #uuid.uuid1(),  # Unique session id
         default_style=upload_style,
     )
Ejemplo n.º 3
0
def get_upload_component(id):
    return du.Upload(
        id=id,
        text='Drag and Drop files here',
        text_completed='Completed: ',
        cancel_button=True,
        max_file_size=1800,  # 1800 Mb
        filetypes=['csv', 'zip'],
        upload_id=uuid.uuid1(),  # Unique session id
        max_files=2,
    )
Ejemplo n.º 4
0
def render_random_id_uploader():

    return du.Upload(id='uploader',
                     text='点击或拖动文件到此进行上传!',
                     text_completed='已完成上传文件:',
                     cancel_button=True,
                     pause_button=True,
                     filetypes=['md', 'mp4'],
                     default_style={
                         'background-color': '#fafafa',
                         'font-weight': 'bold'
                     },
                     upload_id=uuid.uuid1())
def show_ground_truth_upload(ground_truth_given):
    if (ground_truth_given == 'No'):
        return
    return html.Div(["True expression data",
                        du.Upload(
                            id={'type': "du_uploader", 'index': 3},
                             text = 'Drag and Drop or Click here to select a file',
                            max_file_size=1800,
                            filetypes=['tsv'],
                            upload_id=uuid.uuid1(),
                        ),
                        html.Div(id={'type': "upload_file", 'index': 3},style={'display':'none'}),
                        # dcc.Upload(
                        #     id={'type': "upload_file", 'index': 3},
                        #     children=html.Div([
                        #         'Drag and Drop or ',
                        #         html.A('Select a file')
                        #     ]),
                        #     style=upload_style,
                        # ), 
                        html.Div(id={'type': "file_preview", 'index':3})])
Ejemplo n.º 6
0
                     className="mt-3",
                 ),
             ],
         ),
     ],
 ),
 # nlp area
 dbc.Row(
     [
         dbc.Col(
             [
                 html.Div(
                     [
                         du.Upload(
                             id="upload-image",
                             text="Drag and Drop or Select File",
                             text_completed="Image Analysis of ",
                             max_file_size=100,
                         )
                     ],
                     className="container mt-5 text-center",
                 ),
             ],
         ),
     ],
 ),
 dbc.Row(
     [
         dbc.Col(
             [
                 html.Div(id="output-image-raw"),
             ],
Ejemplo n.º 7
0
import dash
import dash_uploader as du
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output, State

app = dash.Dash(__name__)

# 配置上传文件夹
du.configure_upload(app, folder='temp')

app.layout = html.Div(
    dbc.Container(
        [du.Upload(id='uploader'),
         html.H5('上传中或还未上传文件!', id='upload_status')]))


@app.callback(Output('upload_status', 'children'),
              Input('uploader', 'isCompleted'), State('uploader', 'fileNames'))
def show_upload_status(isCompleted, fileNames):
    if isCompleted:
        return '已完成上传:' + fileNames[0]

    return dash.no_update


if __name__ == '__main__':
    app.run_server(debug=True, port=8051)
Ejemplo n.º 8
0
 className="main-box",
 children=[
     dcc.Textarea(
         id= "query-endpoint", 
         value="",
         placeholder="Enter your SPARQL Endpoint.",
         className="querybox--endpoint",
     ),
     du.Upload(
         id='upload-data',
         text='Drag and Drop Here to upload!',
         filetypes=['nt', 'ttl','rdf','n3','xml','tql'],
         default_style={
             'width': '95%',
             'height': '103px',
             'lineHeight': '13px',
             'borderWidth': '1px',
             'borderStyle': 'dashed',
             'margin': 'auto',
             'fontSize': 'small',
             'color': 'gray'
         },
     ),
     dcc.Textarea(
         id= "query-text", 
         value="",
         placeholder="Enter your SPARQL query.",
         className="querybox--textarea",
         n_clicks=0
     ),
     html.Button(
Ejemplo n.º 9
0
            html.Button(['Shutdown'],
                        id='shutdown',
                        n_clicks=None,
                        className='btn btn-danger',
                        type='button'),
            html.Div([], id='runstatus', className='text-center text-danger'),
            html.Br(),

            # ==================================================
            # the du.Upload max_files attribute is still experimental. This is a potential weak point in the app
            # but seems to work fine for now
            # ==================================================
            du.Upload(
                max_files=10,
                filetypes=['txt'],
                text='Drag and drop here or click to browse',
                text_completed=
                'DONE! Click Here or Drag and Drop to Upload More Files. '
                'File(s) Uploaded Include:',
            ),
            html.Br(),
            html.Div([html.Div([], id='errorlog', className='col')],
                     id='errorlogcontainer',
                     className='container'),
            html.Div([
                html.Button(id='processdata',
                            children='Pre-process the data',
                            className='btn btn-secondary',
                            type='button')
            ]),
        ],
        className='jumbotron text-center mx-auto'),
Ejemplo n.º 10
0
import dash
import dash_uploader as du
import dash_bootstrap_components as dbc
import dash_html_components as html

app = dash.Dash(__name__)

# 配置上传文件夹
du.configure_upload(app, folder='temp')

app.layout = html.Div(
    dbc.Container(
        du.Upload(id='uploader',
                  text='点击或拖动文件到此进行上传!',
                  text_completed='已完成上传文件:',
                  cancel_button=True,
                  pause_button=True,
                  filetypes=['md', 'mp4'],
                  default_style={
                      'background-color': '#fafafa',
                      'font-weight': 'bold'
                  },
                  upload_id='我的上传')))

if __name__ == '__main__':
    app.run_server(debug=True)
Ejemplo n.º 11
0
from flask import send_from_directory
import dash
import dash_uploader as du
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import os

app = dash.Dash(__name__)

du.configure_upload(app, 'temp', use_upload_id=False)

app.layout = html.Div(
    dbc.Container(
        [
            du.Upload(id='upload'),
            html.Div(
                id='download-files'
            )
        ]
    )
)

@app.server.route('/download/<file>')
def download(file):

    return send_from_directory('temp', file)

@app.callback(
    Output('download-files', 'children'),
    Input('upload', 'isCompleted')
Ejemplo n.º 12
0
app.layout = html.Div(
    [
        dbc.NavbarSimple(    
            brand="Clound Computation",
            brand_href="#",
            color="dark",
            dark=True,
        ),
        dbc.Container([
            html.H1("HYSYS CSV to DPV File Conversion"),
            html.H2("Upload"),
            du.Upload(
                id="dash-uploader",
                max_file_size=1800,  # 1800 Mb
                filetypes=['csv'],
                max_files=1,
                upload_id=uuid.uuid1(),  # Unique session id
            ),
            html.H2("File List"),
            html.Ul(id="file-list"),
        ])
    ],
    style = {"width": "100%"}
)


def save_file(name, content):
    """Decode and store a file uploaded with Plotly Dash."""
    data = content.encode("utf8").split(b";base64,")[1]
    with open(os.path.join(DOWNLOAD_DIRECTORY, name), "wb") as fp:
Ejemplo n.º 13
0
from sqlalchemy import create_engine
import shutil
import time
import plotly.graph_objs as go
import base64
import io

APP_ID = 'user_large_data_cache'

layout = dbc.Container([
    html.H1('Large User Input File Upload'),
    dcc.Store(id=f'{APP_ID}_session_store'),
    dcc.Store(id=f'{APP_ID}_large_upload_fn_store'),
    dbc.Row([
        dbc.Col(
            du.Upload(id=f'{APP_ID}_large_upload')
        ),
        dbc.Col(
            dcc.Upload(
                id=f'{APP_ID}_dcc_upload',
                children=html.Div([
                    'dcc.Upload '
                ]),
                style={
                    'width': '100%',
                    'height': '60px',
                    'lineHeight': '60px',
                    'borderWidth': '1px',
                    'borderStyle': 'dashed',
                    'borderRadius': '5px',
                    'textAlign': 'center',
Ejemplo n.º 14
0
import numpy as np
from pathlib import Path
import uuid
import io
from base64 import b64encode
from PIL import Image

import moviepy.editor as mpy

APP_ID = 'user_large_video'

layout = dbc.Container([
    html.H1('My Video Editor'),
    dcc.Store(id=f'{APP_ID}_large_upload_fn_store'),
    du.Upload(id=f'{APP_ID}_large_upload', max_file_size=5120),
    dbc.Row([
        dbc.Col([
            dbc.FormGroup([
                dbc.Label('Subclip Start (s)'),
                dbc.Input(id=f'{APP_ID}_t_start_input', type='number')
            ]),
            dbc.FormGroup([
                dbc.Label('Crop Bottom (px)'),
                dbc.Input(id=f'{APP_ID}_crop_bot_input', type='number', value=0)
            ])
        ]),
        dbc.Col([
            dbc.FormGroup([
                dbc.Label('Subclip End(s)'),
                dbc.Input(id=f'{APP_ID}_t_end_input', type='number')
Ejemplo n.º 15
0
                                     persistence=True,
                                     number_of_months_shown=1,
                                     show_outside_days=False,
                                     with_portal=True
                                     ),

                html.H3("Uploaded Files List",
                        style={'placeSelf': 'center'}),
                dcc.Loading(html.Ul(id="file-list"),
                            color='#eabf1a'),

                html.Div(
                    du.Upload(id='dash_uploader',
                              text='Drag and Drop Here to upload!',
                              max_files=1,
                              filetypes=['zip'],
                              default_style={'overflow': 'hide'}

                              ),
                    style={}
                )],
                style=dict(column_style, overflow='auto')
                ),

        dbc.Col([html.P(['After Uploading Files', html.Br(),
                         'Select a month to Calculate'],
                        style={'placeSelf': 'end center'}),
                 html.Div(  # wrapped because of styling problmes in dropdown
                     dcc.Dropdown(id='calculation_selection_dropdown',
                                  options=[{'label': i,
                                            'value': i} for i in directories],                                  
Ejemplo n.º 16
0
from flask import send_from_directory
import dash
import dash_uploader as du
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import os

app = dash.Dash(__name__)

du.configure_upload(app, 'temp', use_upload_id=False)

app.layout = html.Div(
    dbc.Container([du.Upload(id='upload'),
                   html.Div(id='download-files')]))


@app.server.route('/download/<file>')
def download(file):

    return send_from_directory('temp', file)


@app.callback(Output('download-files', 'children'),
              Input('upload', 'isCompleted'))
def render_download_url(isCompleted):

    if isCompleted:
        return html.Ul([
            html.Li(
                html.A(f'/{file}', href=f'/download/{file}', target='_blank'))
Ejemplo n.º 17
0
import dash
import dash_uploader as du
import dash_bootstrap_components as dbc
import dash_html_components as html

app = dash.Dash(__name__)

# 配置上传文件夹
du.configure_upload(app, folder='temp')

app.layout = html.Div(
    dbc.Container(
        du.Upload(max_file_size=1024*1000)
    )
)

if __name__ == '__main__':
    app.run_server(debug=True)
Ejemplo n.º 18
0
for i in [2]:
    app.callback(
        Output(f"navbar-collapse{i}", "is_open"),
        [Input(f"navbar-toggler{i}", "n_clicks")],
        [State(f"navbar-collapse{i}", "is_open")],
    )(toggle_navbar_collapse)

# embedding the navigation bar
app.layout = html.Div([
    dcc.Location(id='url', refresh=False), navbar,
    html.Div([
        du.Upload(id='upload-data',
                  filetypes=['csv'],
                  max_file_size=1800,
                  text='Browse and select CSV file',
                  text_completed='Completed :',
                  pause_button=False,
                  cancel_button=True),
    ],
             className="row"),
    html.Div(id='page-content')
])


@app.callback(Output('page-content', 'children'), [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/apps/bar_testing':
        return bar_testing.layout
    if pathname == '/apps/coorelation_together':
        return coorelation_together.layout
Ejemplo n.º 19
0
                    },
                    children=[
                        DashTabulator(
                            id='ms-table',
                            columns=columns,
                            options=options,
                            clearFilterButtonType=clearFilterButtonType)
                    ])

_label = 'MS-Files'

_layout = html.Div([
    html.H3('Upload MS-files'),
    html.Div(du.Upload(
        id='ms-uploader',
        filetypes=['tar', 'zip', 'mzxml', 'mzml', 'mzXML', 'mzML'],
        upload_id=uuid.uuid1(),
        max_files=10000,
        text='Upload mzXML/mzML files.'),
             style={
                 'textAlign': 'center',
                 'width': '100%',
                 'padding': '0px',
                 'margin-bottom': '20px',
                 'display': 'inline-block',
             }),
    html.Button('Import from URL', id='ms-import-from-url'),
    dcc.Input(id='url',
              placeholder='Drop URL / path here',
              style={'width': '100%'}),
    dcc.Markdown('---', style={'marginTop': '10px'}),
    dcc.Markdown('##### Actions'),
Ejemplo n.º 20
0
    'textAlign': 'center',
    'margin': '10px',
}
input_layout = html.Div(children=[
    html.H2(children='Data'),
    html.Label(["Data types",
            dcc.RadioItems(
                options=data_sample_options, id='data_sample_option', value='single_sample', labelStyle={'display': 'inline-block'})]),
    html.Label(["Number of methods",
        dcc.RadioItems(
            options=multi_methods_options, id='multi_methods_option', value='single_method', labelStyle={'display': 'inline-block'})]),
    html.Div(["Quantification result",
                html.Div(id='single_method_quantif_uploader',children=[du.Upload(
                    id={'type': "du_uploader", 'index': 1},
                    text = 'Drag and Drop or Click here to select a file',
                    max_files = 1,
                    max_file_size=4096,
                    filetypes=['tsv'],
                    upload_id=uuid.uuid1(),
                ),html.Div(id={'type': "upload_file", 'index':1},style={'display':'none'}),html.Div(id={'type': "file_preview", 'index':1})]),
                html.Div(id='multi_method_quantif_uploader',children=[du.Upload(
                    id={'type': "du_uploader", 'index': 2},
                    text = 'Drag and Drop or Click here to select a zip file',
                    max_files = 1,
                    max_file_size=4096,
                    filetypes=['zip'],
                    upload_id=uuid.uuid1(),
                ),html.Div(id={'type': "upload_file", 'index':2},style={'display':'none'}),html.Div(id={'type': "file_preview", 'index':2})]),
                ]),
                # dcc.Upload(
                #     id={'type': "upload_file", 'index': 1},
                #     children=html.Div([
Ejemplo n.º 21
0
def upload_page():
    return (html.Div([
        html.H2("Loading anndata"),
        html.Hr(),
        html.Div(id="upload-message"),
        html.H5("Choose dataset"),
        dcc.Dropdown(options=get_datasets(),
                     id="dataset-dropdown",
                     className="mb-3"),
        dbc.Button(
            "Submit",
            id="submit-datafile",
            className="mb-3 mr-3 mt-3",
            color="success",
        ),
        dbc.Button("Upload your own .h5ad data", id="open", color="primary"),
        html.Div([
            dbc.Modal(
                [
                    dbc.ModalHeader("Header"),
                    dbc.ModalBody([
                        html.H5("Local files"),
                        html.Div(
                            [
                                du.Upload(
                                    id='dash-uploader',
                                    upload_id=uuid.uuid1(
                                    ),  # Unique session id
                                ),
                                html.Div(id='callback-output'),
                            ],
                            className="mb-3",
                        ),
                        html.H5("Google drive file link (faster): "),
                        dbc.Row([
                            dbc.Col([
                                dcc.Input(placeholder='Dataset name',
                                          type='text',
                                          value='',
                                          style={"width": "100%"},
                                          id="name"),
                            ],
                                    width=4),
                            dbc.Col([
                                dcc.Input(
                                    placeholder='Public google drive link',
                                    type='text',
                                    value='',
                                    style={"width": "100%"},
                                    id="link"),
                            ]),
                            dbc.Col([dbc.Button(
                                "Download",
                                id="download",
                            )],
                                    width=2)
                        ]),
                        html.Div([
                            dbc.Spinner(html.Div(id="loading-output")),
                        ])
                    ]),
                    dbc.ModalFooter(
                        dbc.Button("Done", id="close", className="ml-auto")),
                ],
                id="modal",
                size="xl",
            ),
        ]),
    ]))
Ejemplo n.º 22
0
 ),
 html.Div(
     [
         html.Div(
             style={
                 'backgroundColor': "#d0d1ff",
                 'margin': 15
             },
             children=[
                 html.P(
                     "Try your own data!",
                     className="control_label",
                 ),
                 du.Upload(
                     id='dash-uploader',
                     max_file_size=1800,  # 1800 Mb
                     filetypes=['csv', 'zip'],
                     upload_id=uuid.uuid1(),  # Unique session id
                 ),
                 html.Div(id='callback-output'),
                 html.Div(id='intermediate-value',
                          style={'display': 'none'}),
             ],
             className="pretty_container four columns",
             id="cross-filter-options"),
         html.Div([
             html.Div(
                 [
                     dcc.Graph(id='scatter',
                               config={'displayModeBar': False})
                 ],
                 id="countGraphContainer",
Ejemplo n.º 23
0
             You can upload up to 10 files at a time.''', style={'margin': 'auto', 'padding': 'auto'})
         ]),
         style={
             'width': '100%',
             'height': '120px',
             'lineHeight': '120px',
             'borderWidth': '1px',
             'borderStyle': 'dashed',
             'borderRadius': '5px',
             'textAlign': 'center',
             'marginBottom': '15px',
         },
         # Allow multiple files to be uploaded
         multiple=True),
 html.Div( du.Upload(id='ms-upload-zip', filetypes=['tar', 'zip'], 
                     upload_id=uuid.uuid1(),
                     text='Click here to drag and drop ZIP/TAR compressed archives'),
           style={
                 'textAlign': 'center',
                 'width': '100%',
                 'padding': '0px',
                 'margin-bottom': '20px',
                 'display': 'inline-block',
             }),
             
 html.Button('Import from URL or local path', id='ms-import-from-url'),
 dcc.Input(id='url', placeholder='Drop URL / path here', style={'width': '100%'}),
 dcc.Markdown('---', style={'marginTop': '10px'}),
 dcc.Markdown('##### Actions'),
 html.Button('Convert to Feather', id='ms-convert'),
 html.Button('Delete selected files', id='ms-delete', style={'float': 'right'}),
Ejemplo n.º 24
0
import dash_uploader as du
import os
from flask import send_from_directory
import time

app = dash.Dash(__name__, suppress_callback_exceptions=True)

du.configure_upload(app, 'NetDisk', use_upload_id=False)

app.layout = html.Div(
    dbc.Container([
        html.H3('简易的个人云盘应用'),
        html.Hr(),
        html.P('文件上传区:'),
        du.Upload(id='upload',
                  text='点击或拖动文件到此进行上传!',
                  text_completed='已完成上传文件:',
                  max_files=1000),
        html.Hr(),
        dbc.Row([
            dbc.Button('删除选中的文件', id='delete-btn', outline=True),
            dbc.Button('打包下载选中的文件', id='download-btn', outline=True)
        ]),
        html.Hr(),
        dbc.Spinner(dbc.Checklist(id='file-list-check')),
        html.A(id='download-url', target='_blank')
    ]))


@app.server.route('/download/<file>')
def download(file):
    return send_from_directory('NetDisk', file)
Ejemplo n.º 25
0
import dash
import dash_uploader as du
import dash_bootstrap_components as dbc
import dash_html_components as html

app = dash.Dash(__name__)

# 配置上传文件夹
du.configure_upload(app, folder='temp')

app.layout = html.Div(
    dbc.Container(
        du.Upload()
    )
)

if __name__ == '__main__':
    app.run_server(debug=True)
Ejemplo n.º 26
0
from sqlalchemy import create_engine
import cchardet as chardet

postgres_url = 'postgresql://*****:*****@localhost:5432/Dash'
engine = create_engine(postgres_url)

app = dash.Dash(__name__)

du.configure_upload(app, 'upload')

app.layout = html.Div(
    dbc.Container(
        [
            du.Upload(id='upload',
                      filetypes=['csv'],
                      text='点击或拖动文件到此进行上传!',
                      text_completed='已完成上传文件:',
                      cancel_button=True,
                      pause_button=True),
            html.Hr(),
            dbc.Form([
                dbc.FormGroup([
                    dbc.Label("设置入库表名", html_for="table-name"),
                    dbc.Input(id='table-name', autoComplete='off'),
                    dbc.FormText(
                        "表名只允许包含大小写字母、下划线或数字,且不能以数字开头,同时请注意表名是否与库中现有表重复!",
                        color="secondary"),
                    dbc.FormFeedback("表名合法!", valid=True),
                    dbc.FormFeedback(
                        "表名不合法!",
                        valid=False,
                    ),
Ejemplo n.º 27
0
PEPTIDE_TABLE_FORMAT: str = None
FASTA_DATABASE_PATH: str = None
GENE_EXPRESSION_TABLE: str = None
PROTEIN_LOC_TABLE: str = None
NEW_LINE: str = '\n'
experiment: Experiment = None
MAPPED_PROTEINS: Dict[str, np.ndarray] = None
# define the layout of the app
app.layout = html.Div([
    dbc.Row(html.H1('Experimental information')),
    dbc.Row([
        html.Div([
            html.H3('Identification File '),
            html.Div(
                [
                    du.Upload(id='upload_ident_table',
                              filetypes=['csv', 'pepXML', 'idXML', 'mzTab'])
                ],
                style={
                    'textAlign': 'center',
                    'width': '600px',
                    'padding': '10px',
                    'display': 'inline-block'
                })
        ],
                 style={
                     'width': '50%',
                     'display': 'inline-block'
                 }),
        html.Div(id='identification_table_hidden_output',
                 style={'display': 'none'})
    ], ),