Hi,
I wanna make a image processing app. And my base code is like this:
import datetime
import pandas as pd
import numpy as np
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import cv2
from PIL import Image, ImageTk
import base64, rawpy
from io import BytesIO
from matplotlib import pyplot as plt
import plotly.express as px
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
dcc.Upload(
id='upload-image',
children=html.Div([
'Drag and Drop or ',
html.A('Select Files')
]),
style={
'width': '100%',
'height': '60px',
'lineHeight': '60px',
'borderWidth': '1px',
'borderStyle': 'dashed',
'borderRadius': '5px',
'textAlign': 'center',
'margin': '10px'
},
multiple=True
),
html.Div(id='output-image-upload', style={'height':'5%', 'width':'5%'}), html.Hr()
])
def parse_contents(contents, filename, date):
return html.Div([
html.H5(filename),
html.H6(datetime.datetime.fromtimestamp(date)),
html.Img(src=contents)
])
@app.callback(Output('output-image-upload', 'children'),
Input('upload-image', 'contents'),
State('upload-image', 'filename'),
State('upload-image', 'last_modified'))
def update_output(list_of_contents, list_of_names, list_of_dates):
f_contents = []
if list_of_contents is not None:
children = [
parse_contents(c, n, d) for c, n, d in
zip(list_of_contents, list_of_names, list_of_dates)
]
return children
if __name__ == '__main__':
app.run_server(debug=False, port=1010)
AFter I run the app, I choose some images from my local machine. (4 or 6 images). And photos are in down order. But I wanna show them side by side.
Currently they are like left one, but i wanna show them like right one.
What can you advice me?
I cant say any number about photos. Dynamicly maybe I can choose 4 maybe 6 maybe 2.