Skip to content

Commit

Permalink
Update READMEs for UMD files (#1195)
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinscott authored Oct 9, 2023
1 parent 179d4e2 commit 5ca0810
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 15 deletions.
6 changes: 6 additions & 0 deletions examples/basic-umd/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ <h1>Basic Example With a Script Tag</h1>
</table>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/default-model@latest/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/2x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/3x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/4x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/upscaler@latest/dist/browser/umd/upscaler.min.js"></script>
<script>
console.log(ESRGANSlim.x2)
console.log(ESRGANSlim2x)
const target = document.getElementById('target');
const button = document.getElementById('button');
const info = document.getElementById('info');
Expand Down
24 changes: 21 additions & 3 deletions models/esrgan-legacy/DOC.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ const upscaler = new Upscaler({

#### Using a script tag

If importing Tensorflow.js using script tags, import the model and UpscalerJS with:
If importing Tensorflow.js using script tags, import the specific model and UpscalerJS with:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-legacy@latest/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-legacy@latest/dist/umd/gans.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/upscaler@latest/dist/browser/umd/upscaler.min.js"></script>
<script type="text/javascript">
Expand All @@ -99,7 +99,15 @@ If importing Tensorflow.js using script tags, import the model and UpscalerJS wi
</script>
```

All models will be made available on the global window object. See [Available Models](#available-models) for information on their names.
The model will be made available on the global window object. See [Available Models](#available-models) for information on referencing by name.

You can also import all models in this package via the `index.min.js` import:

```html
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrga-legacy@latest/dist/umd/index.min.js"></script>
```

If so, all model configurations will be available on the global object ESRGANLegacy.

### Node

Expand Down Expand Up @@ -149,6 +157,16 @@ If referencing the models via script tags, refer to the models by their global n
- `div2k/4x`: `ESRGANLegacyDiv2K4x`,
- `psnr-small`: `ESRGANLegacyPSNRSmall`,

Specific model files can be loaded by specifying the model:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-legacy@latest/dist/umd/gans.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-legacy@latest/dist/umd/div2k/2x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-legacy@latest/dist/umd/div2k/3x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-legacy@latest/dist/umd/div2k/4x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-legacy@latest/dist/umd/psnr-small.min.js"></script>
```

### GANS

The `gans` model uses the [pretrained `gans` weights made available via the original Python repo](https://github.com/idealo/image-super-resolution#pre-trained-networks).
Expand Down
23 changes: 20 additions & 3 deletions models/esrgan-medium/DOC.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ const upscaler = new Upscaler({

#### Using a script tag

If importing Tensorflow.js using script tags, import the model and UpscalerJS with:
If importing Tensorflow.js using script tags, import the specific model and UpscalerJS with:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-medium@latest/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-medium@latest/dist/umd/2x.min.js"></script> <!-- loads the 2x model -->
<script src="https://cdn.jsdelivr.net/npm/upscaler@latest/dist/browser/umd/upscaler.min.js"></script>
<script type="text/javascript">
Expand All @@ -92,7 +92,15 @@ If importing Tensorflow.js using script tags, import the model and UpscalerJS wi
</script>
```

All models will be made available on the global window object. See [Available Models](#available-models) for information on their names.
The model will be made available on the global window object. See [Available Models](#available-models) for information on referencing by name.

You can also import all models in this package via the `index.min.js` import:

```html
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-medium@latest/dist/umd/index.min.js"></script>
```

If so, all model configurations will be available on the global object `ESRGANMedium`.

### Node

Expand Down Expand Up @@ -139,6 +147,15 @@ If referencing the models via script tags, refer to the models by their global n
- `4x`: `ESRGANMedium4x`
- `8x`: `ESRGANMedium8x`

Specific model files can be loaded by specifying the scale:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-medium@latest/dist/umd/2x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-medium@latest/dist/umd/3x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-medium@latest/dist/umd/4x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-medium@latest/dist/umd/8x.min.js"></script>
```

## Performance + Speed Measurements

import PerformanceChart from '@site/src/components/chart/performanceChart/performanceChart';
Expand Down
1 change: 1 addition & 0 deletions models/esrgan-medium/doc-snippets/umdName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ESRGANMedium
23 changes: 20 additions & 3 deletions models/esrgan-slim/DOC.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ const upscaler = new Upscaler({

#### Using a script tag

If importing Tensorflow.js using script tags, import the model and UpscalerJS with:
If importing Tensorflow.js using script tags, import the specific model and UpscalerJS with:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/2x.min.js"></script> <!-- loads the 2x model -->
<script src="https://cdn.jsdelivr.net/npm/upscaler@latest/dist/browser/umd/upscaler.min.js"></script>
<script type="text/javascript">
Expand All @@ -92,7 +92,15 @@ If importing Tensorflow.js using script tags, import the model and UpscalerJS wi
</script>
```

All models will be made available on the global window object. See [Available Models](#available-models) for information on their names.
The model will be made available on the global window object. See [Available Models](#available-models) for information on referencing by name.

You can also import all models in this package via the `index.min.js` import:

```html
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/index.min.js"></script>
```

If so, all model configurations will be available on the global object `ESRGANSlim`.

### Node

Expand Down Expand Up @@ -139,6 +147,15 @@ If referencing the models via script tags, refer to the models by their global n
- `4x`: `ESRGANSlim4x`
- `8x`: `ESRGANSlim8x`

Specific model files can be loaded by specifying the scale:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/2x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/3x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/4x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-slim@latest/dist/umd/8x.min.js"></script>
```

## Performance + Speed Measurements

import PerformanceChart from '@site/src/components/chart/performanceChart/performanceChart';
Expand Down
1 change: 1 addition & 0 deletions models/esrgan-slim/doc-snippets/umdName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ESRGANSlim
23 changes: 20 additions & 3 deletions models/esrgan-thick/DOC.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ const upscaler = new Upscaler({

#### Using a script tag

If importing Tensorflow.js using script tags, import the model and UpscalerJS with:
If importing Tensorflow.js using script tags, import the specific model and UpscalerJS with:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-thick@latest/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-thick@latest/dist/umd/2x.min.js"></script> <!-- loads the 2x model -->
<script src="https://cdn.jsdelivr.net/npm/upscaler@latest/dist/browser/umd/upscaler.min.js"></script>
<script type="text/javascript">
Expand All @@ -94,7 +94,15 @@ If importing Tensorflow.js using script tags, import the model and UpscalerJS wi
</script>
```

All models will be made available on the global window object. See [Available Models](#available-models) for information on their names.
The model will be made available on the global window object. See [Available Models](#available-models) for information on referencing by name.

You can also import all models in this package via the `index.min.js` import:

```html
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-thick@latest/dist/umd/index.min.js"></script>
```

If so, all model configurations will be available on the global object `ESRGANThick`.

### Node

Expand Down Expand Up @@ -141,6 +149,15 @@ If referencing the models via script tags, refer to the models by their global n
- `4x`: `ESRGANThick4x`
- `8x`: `ESRGANThick8x`

Specific model files can be loaded by specifying the scale:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-thick@latest/dist/umd/2x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-thick@latest/dist/umd/3x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-thick@latest/dist/umd/4x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/esrgan-thick@latest/dist/umd/8x.min.js"></script>
```

## Performance + Speed Measurements

import PerformanceChart from '@site/src/components/chart/performanceChart/performanceChart';
Expand Down
1 change: 1 addition & 0 deletions models/esrgan-thick/doc-snippets/umdName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ESRGANThick
23 changes: 20 additions & 3 deletions packages/shared/src/esrgan/DOC.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ const upscaler = new Upscaler({

#### Using a script tag

If importing Tensorflow.js using script tags, import the model and UpscalerJS with:
If importing Tensorflow.js using script tags, import the specific model and UpscalerJS with:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/<% key %>@latest/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/<% key %>@latest/dist/umd/2x.min.js"></script> <!-- loads the 2x model -->
<script src="https://cdn.jsdelivr.net/npm/upscaler@latest/dist/browser/umd/upscaler.min.js"></script>
<script type="text/javascript">
Expand All @@ -78,7 +78,15 @@ If importing Tensorflow.js using script tags, import the model and UpscalerJS wi
</script>
```

All models will be made available on the global window object. See [Available Models](#available-models) for information on their names.
The model will be made available on the global window object. See [Available Models](#available-models) for information on referencing by name.

You can also import all models in this package via the `index.min.js` import:

```html
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/<% key %>@latest/dist/umd/index.min.js"></script>
```

If so, all model configurations will be available on the global object `<% snippets/umdName %>`.

### Node

Expand Down Expand Up @@ -122,6 +130,15 @@ If referencing the models via script tags, refer to the models by their global n

<% snippets/umdNames %>

Specific model files can be loaded by specifying the scale:

```
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/<% key %>@latest/dist/umd/2x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/<% key %>@latest/dist/umd/3x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/<% key %>@latest/dist/umd/4x.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@upscalerjs/<% key %>@latest/dist/umd/8x.min.js"></script>
```
## Performance + Speed Measurements
import PerformanceChart from '@site/src/components/chart/performanceChart/performanceChart';
Expand Down

0 comments on commit 5ca0810

Please sign in to comment.