Skip to content

Commit

Permalink
Fix examples (#247)
Browse files Browse the repository at this point in the history
* Bump to latest version and add babelrc

* Migrate examples to use esbuild instead of parcel

* Remove yarnrc from repo

* Ignore yarnrc
  • Loading branch information
thekevinscott authored Mar 5, 2022
1 parent ccf3a40 commit bdf227b
Show file tree
Hide file tree
Showing 28 changed files with 812 additions and 165 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ scratch
packages/upscalerjs/src/tfjs.ts
*.generated.ts
.vscode
.yarnrc
9 changes: 3 additions & 6 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
"description": "Demonstration of basic usage of UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open"
"copy": "rm -rf dist && mkdir dist && cp index.html dist && cp flower.png dist",
"start": "yarn copy && esbuild index.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"browserslist": {
"production": [
Expand Down
9 changes: 3 additions & 6 deletions examples/comparisons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
"description": "Demonstration of the different models of UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open"
"copy": "rm -rf dist && mkdir dist && cp index.html dist && cp flower.png dist",
"start": "yarn copy && esbuild index.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion examples/models/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "^4.0.2",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"scripts": {
"start": "react-scripts start"
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs-custom-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@upscalerjs/models": "0.9.0",
"@tensorflow/tfjs-node": "^3.13.0",
"upscaler": "0.10.0-canary.1",
"upscaler": "0.11.0",
"express": "4.16.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@tensorflow/tfjs-node": "^3.13.0",
"upscaler": "0.10.0-canary.1",
"upscaler": "0.11.0",
"express": "4.16.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/patch-sizes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"react-input-range": "^1.3.0",
"react-scripts": "^4.0.3",
"tensor-as-base64": "^0.1.1",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"scripts": {
"start": "PORT=1234 react-scripts start"
Expand Down
9 changes: 3 additions & 6 deletions examples/progress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
"description": "Demonstration of upscale progress with UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open"
"copy": "rm -rf dist && mkdir dist && cp index.html dist && cp flower.png dist",
"start": "yarn copy && esbuild index.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion examples/react-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"react-dom": "^16.13.1",
"react-dropzone": "^11.0.2",
"react-scripts": "^4.0.2",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"scripts": {
"start": "react-scripts start"
Expand Down
9 changes: 3 additions & 6 deletions examples/tensor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
"description": "Demonstration of basic usage of UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open"
"copy": "rm -rf dist && mkdir dist && cp index.html dist && cp flower.png dist",
"start": "yarn copy && esbuild index.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"browserslist": {
"production": [
Expand Down
10 changes: 3 additions & 7 deletions examples/upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
"description": "Demonstration of uploading an image to UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open",
"build": "cross-env NODE_ENV=production parcel build index.html --no-minify --public-url ./"
"copy": "rm -rf dist && mkdir dist && cp index.html dist",
"start": "yarn copy && esbuild index.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"browserslist": {
"production": [
Expand Down
10 changes: 3 additions & 7 deletions examples/warmup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
"description": "Demonstration of warming up UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open",
"build": "cross-env NODE_ENV=production parcel build index.html --no-minify --public-url ./"
"copy": "rm -rf dist && mkdir dist && cp index.html dist && cp flower.png dist",
"start": "yarn copy && esbuild index.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion examples/webcam/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1>Webcam Example</h1>
An example of using a webcam for upscaling with
<a target="_blank" href="https://github.com/thekevinscott/UpscalerJS">UpscalerJS</a>.
</p>
<video autoplay="true" id="video" width="400" height="300"></video>
<video autoplay="true" id="video" width="200" height="150"></video>
<p>Click the upscale button to upscale a frame of video.</p>
<button id="button" disabled>Upscale</button>
<p id="info"></p>
Expand Down
2 changes: 1 addition & 1 deletion examples/webcam/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ navigator.mediaDevices
info.innerText = "Upscaling...";
const start = new Date().getTime();
upscaler.upscale(data, {
patchSize: 64,
patchSize: 16,
padding: 4,
}).then(upscaledImgSrc => {
const img = document.createElement("img");
Expand Down
10 changes: 3 additions & 7 deletions examples/webcam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
"description": "Demonstration of webcam usage of UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open",
"build": "cross-env NODE_ENV=production parcel build index.html --no-minify --public-url ./"
"copy": "rm -rf dist && mkdir dist && cp index.html dist",
"start": "yarn copy && esbuild index.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
},
"browserslist": {
"production": [
Expand Down
Binary file removed examples/webworker/flower-256.png
Binary file not shown.
Binary file removed examples/webworker/flower.png
Binary file not shown.
10 changes: 3 additions & 7 deletions examples/webworker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Demonstration of webworker integration with UpscalerJS",
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development parcel index.html --no-hmr --open",
"build": "cross-env NODE_ENV=production parcel build index.html --no-minify --public-url ./"
"copy": "rm -rf dist && cp -r src dist",
"start": "yarn copy && esbuild src/*.js --servedir=dist --outdir=dist --bundle --loader:.png=dataurl"
},
"browserslist": {
"production": [
Expand All @@ -21,13 +21,9 @@
},
"author": "Kevin Scott",
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.2",
"parcel": "1.12.3"
},
"dependencies": {
"@tensorflow/tfjs": "^3.13.0",
"tensor-as-base64": "^0.1.1",
"upscaler": "0.9.0"
"upscaler": "0.11.0"
}
}
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h1>WebWorker Example</h1>
<tbody>
<tr>
<td>
<img src="/flower-256.png" id="flower" />
<img src="/flower.png" id="flower" />
</td>
<td>
<div id="target"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as tf from '@tensorflow/tfjs';
import Upscaler from 'upscaler';
import img from './flower-256.png';
import img from './flower.png';
import { writeOutput, disable } from './ui';
import tensorAsBase64 from 'tensor-as-base64';

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"update:version:old": "node ./scripts/version.js",
"pin-cdn": "node scripts/pin-cdn.js",
"find-all-packages": "ts-node scripts/package-scripts/find-all-packages.ts",
"example": "node ./scripts/start-example.js",
"example": "ts-node ./scripts/start-example.ts",
"format": "yarn lerna run format",
"lint": "yarn lerna run lint",
"push": "yarn lerna publish from-package",
Expand Down
79 changes: 0 additions & 79 deletions scripts/start-example.js

This file was deleted.

Loading

0 comments on commit bdf227b

Please sign in to comment.