Skip to content

Commit

Permalink
browser refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Leao authored and Eduardo Leao committed Aug 7, 2024
1 parent 8769e0d commit 098a166
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,16 @@ <h2 id="about" style="margin-top: 10px;">About</h2>
<li>For access to the source code, visit <a href="https://github.com/eduardoleao052/js-pytorch", target="_blank">The GitHub repo</a>.</li>
</ul>
<h2 id="installation">Installation</h2>
<p>This is a <strong>node</strong> package, and can be installed with <strong>npm</strong> (Node Package Manager). It has full sopport of node 20.15.1, which is the latest LTS (Long-Term Support) node version. </p>
<p>In most operating systems, it should also work for <strong>more recent</strong> versions.</p>
<p>To install in the <b>browser</b>, link js-pytorch-browser.js to your HTML file:</p>
<pre><code class="language-html line-numbers">&lt;script src="dist/js-pytorch-browser.js"&gt;&lt;/script&gt;
&lt;script type="module"&gt;
import { torch } from 'dist/js-pytorch-browser.js';
&lt;/script&gt;
<p>This is a <strong>node</strong> package, and can be installed with <strong>npm</strong> (Node Package Manager). It has full support of node 20.15.1, which is the latest LTS (Long-Term Support) node version, and more recent versions. </p>
<p>To run JS-PyTorch in the <b>browser</b>, first install it using npm, then link it to your HTML file:</p>
<pre><code class="language-html line-numbers">&lt;script src="./node_modules/js-pytorch/dist/utils.js"&gt;&lt;/script&gt;
&lt;script type="module"&gt;
import { torch } from './node_modules/js-pytorch/dist/js-pytorch-browser.js';
window.torch = torch;
&lt;/script&gt;
</code></pre>
<p>After that, you can use JS-PyTorch freely in any <b>script</b> in your HTML file.</p>

<h3 id="macos">MacOS</h3>
<ul>
<li>First, install <strong>node</strong> with the command line, as described on the <a href="https://nodejs.org/en/download/package-manager" target="_blank">node website</a>:</li>
Expand Down

0 comments on commit 098a166

Please sign in to comment.