I’m a newbie to dash and need to figure out how to add captions to the images in my code as stated as follows.
@app.callback(
Output('result', 'children'),
[Input('button', 'n_clicks')],
[State('pid', 'value')],
)
def recs(n_clicks, pid):
if n_clicks is None:
return {}
recs = model.recommend(pid)
imgs = []
for row in recs.itertuples():
imgs.append(
html.Img(src=product_img(row[1]), className='d-flex p-2',
width='150', height='200'))
return imgs