<!DOCTYPE html><htmlclass="default"lang="en"><head><metacharSet="utf-8"/><metahttp-equiv="x-ua-compatible"content="IE=edge"/><title>browserFiles | @vladmandic/face-api - v1.7.13</title><metaname="description"content="Documentation for @vladmandic/face-api"/><metaname="viewport"content="width=device-width, initial-scale=1"/><linkrel="stylesheet"href="../assets/style.css"/><linkrel="stylesheet"href="../assets/highlight.css"/><scriptdefersrc="../assets/main.js"></script><scriptasyncsrc="../assets/search.js"id="tsd-search-script"></script><scriptasyncsrc="../assets/navigation.js"id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme=localStorage.getItem("tsd-theme")||"os"</script><headerclass="tsd-page-toolbar"><divclass="tsd-toolbar-contents container"><divclass="table-cell"id="tsd-search"data-base=".."><divclass="field"><labelfor="tsd-search-field"class="tsd-widget tsd-toolbar-icon search no-caption"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="#icon-search"></use></svg></label><inputtype="text"id="tsd-search-field"aria-label="Search"/></div><divclass="field"><divid="tsd-toolbar-links"></div></div><ulclass="results"><liclass="state loading">Preparing search index...</li><liclass="state failure">The search index is not available</li></ul><ahref="../index.html"class="title">@vladmandic/face-api - v1.7.13</a></div><divclass="table-cell"id="tsd-widgets"><ahref="#"class="tsd-widget tsd-toolbar-icon menu no-caption"data-toggle="menu"aria-label="Menu"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="#icon-menu"></use></svg></a></div></div></header><divclass="container container-main"><divclass="col-content"><divclass="tsd-page-title"><ulclass="tsd-breadcrumb"><li><ahref="../index.html">@vladmandic/face-api</a></li><li><ahref="../modules/tf.html">tf</a></li><li><ahref="../modules/tf.io.html">io</a></li><li><ahref="tf.io.browserFiles.html">browserFiles</a></li></ul><h1>Function browserFiles</h1></div><sectionclass="tsd-panel"><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="browserFiles"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">browser<wbr/>Files</span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">files</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><ahref="../interfaces/tf.io.IOHandler.html"class="tsd-signature-type tsd-kind-interface">IOHandler</a><ahref="#browserFiles"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Creates an IOHandler that loads model artifacts from user-selected files.</p>
<p>This method can be used for loading from files such as user-selected files
in the browser.
When used in conjunction with <code>tf.loadLayersModel</code>, an instance of
<code>tf.LayersModel</code> (Keras-style) can be constructed from the loaded artifacts.</p>
<pre><codeclass="language-js"><spanclass="hl-7">// Note: This code snippet won't run properly without the actual file input</span><br/><spanclass="hl-7">// elements in the HTML DOM.</span><br/><br/><spanclass="hl-7">// Suppose there are two HTML file input (`<input type="file" ...>`)</span><br/><spanclass="hl-7">// elements.</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">uploadJSONInput</span><spanclass="hl-1"> = </span><spanclass="hl-5">document</span><spanclass="hl-1">.</span><spanclass="hl-3">getElementById</span><spanclass="hl-1">(</span><spanclass="hl-8">'upload-json'</span><spanclass="hl-1">);</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">uploadWeightsInput</span><spanclass="hl-1"> = </span><spanclass="hl-5">document</span><spanclass="hl-1">.</span><spanclass="hl-3">getElementById</span><spanclass="hl-1">(</span><spanclass="hl-8">'upload-weights'</span><spanclass="hl-1">);</span><br/><spanclass="hl-0">const</span><spanclass="hl-1"></span><spanclass="hl-2">model</span><spanclass="hl-1"> = </span><spanclass="hl-6">await</span><spanclass="hl-1"></span><spanclass="hl-5">tf</span><spanclass="hl-1">.</span><spanclass="hl-3">loadLayersModel</span><spanclass="hl-1">(</span><spanclass="hl-5">tf</span><spanclass="hl-1">.</span><spanclass="hl-5">io</span><spanclass="hl-1">.</span><spanclass="hl-3">browserFiles</span><spanclass="hl-1">(</span><br/><spanclass="hl-1"> [</span><spanclass="hl-5">uploadJSONInput</span><spanclass="hl-1">.</span><spanclass="hl-5">files</span><spanclass="hl-1">[</span><spanclass="hl-4">0</span><spanclass="hl-1">], </span><spanclass="hl-5">uploadWeightsInput</span><spanclass="hl-1">.</span><spanclass="hl-5">files</span><spanclass="hl-1">[</span><spanclass="hl-4">0</span><spanclass="hl-1">]]));</span>
</code><button>Copy</button></pre>
</div><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><h5><spanclass="tsd-kind-parameter">files</span>: <spanclass="tsd-signature-type">File</span><spanclass="tsd-signature-symbol">[]</span></h5><divclass="tsd-comment tsd-typography"><p><code>File</code>s to load from. Currently, this function supports only
loading from files that contain Keras-style models (i.e., <code>tf.Model</code>s), for
which an <code>Array</code> of <code>File</code>s is expected (in that order):</p>
<ul>
<li>A JSON file containing the model topology and weight manifest.</li>
<li>Optionally, one or more binary files containing the binary weights.
These files must have names that match the paths in the <code>weightsManifest</code>
contained by the aforementioned JSON file, or errors will be thrown
during loading. These weights files have the same format as the ones
generated by <code>tensorflowjs_converter</code> that comes with the <code>tensorflowjs</code>
Python PIP package. If no weights files are provided, only the model
topology will be loaded from the JSON file above.</li>
</ul>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <ahref="../interfaces/tf.io.IOHandler.html"class="tsd-signature-type tsd-kind-interface">IOHandler</a></h4><p>An instance of <code>Files</code><code>IOHandler</code>.</p>