MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / displaySearchResults

Function displaySearchResults

electron/renderer.js:96–112  ·  view source on GitHub ↗

* Display result results (from backend or frontend). * * @param {object} results Search result object. Assumed to have the following * fields: * - targetWords {string[]} The target words searched for. * - numSearchedFiles {number} Total number of image files searched over. * - foundIte

(results)

Source from the content-addressed store, hash-verified

94 * inference.
95 */
96function displaySearchResults(results) {
97 hideProgress();
98 if (results.foundItems.length === 0) {
99 showSnackbar(
100 `No match for "${results.targetWords.join(',')}" ` +
101 `after searching ${results.numSearchedFiles} file(s). ` +
102 `Model inference took ${results.tElapsedMillis.toFixed(1)} ms`);
103 } else {
104 showSnackbar(
105 `Found ${results.foundItems.length} ` +
106 `matches from ${results.numSearchedFiles} image(s). ` +
107 `Model inference took ${results.tElapsedMillis.toFixed(1)} ms`);
108 results.foundItems.forEach(foundItem => {
109 createFoundCard(searchResultsDiv, foundItem);
110 });
111 }
112}
113
114/**
115 * Display a snackbar message on the screen.

Callers 1

renderer.jsFile · 0.85

Calls 3

hideProgressFunction · 0.85
showSnackbarFunction · 0.85
createFoundCardFunction · 0.85

Tested by

no test coverage detected