summaryrefslogtreecommitdiff
path: root/client/common/detectionList.component.js
blob: 416e66d8b20db69603fa541ccbf8a277b53830c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import React from 'react'

export default function DetectionList({ detections, labels, tag, showEmpty }) {
  return (
    <span className='detectionList'>
      {tag && <h3>{tag}</h3>}
      {!detections.length && showEmpty && <label><small>No detections</small></label>}
      {detections.map(({ idx, score, rect }, i) => (
        <label key={i}>
          <small className='title'>{(labels[idx] || 'Unknown').replace(/_/, ' ')}</small>
          <small>{score.toFixed(2)}</small>
        </label>
      ))}
    </span>
  )
}