Skip to content

Commit db9a6c0

Browse files
committed
wasm example corrected
1 parent 9c24427 commit db9a6c0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

example/wasm/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ This simple js web demo uses Dart Web Assembly support
77
## building/running
88
- Serve the output, example
99

10-
$ cd site
1110
$ dart pub global activate dhttpd
1211
$ dart pub global run dhttpd
1312

14-
- Open your brwoser at : http://localhost:8080/site/index.html
13+
- Open your browser at : http://localhost:8080/site/index.html
1514

1615
- type flower dimensions and run either using :
1716
- a preloaded model (faster)
18-
- training a (small) model on on the fly
17+
- training a (small) model on the fly
1918

2019
![screenshot](screenshot.png)
2120

2221

2322
- Compile with Wasm to a new site output directory:
2423

25-
mywebapp$ dart compile wasm web/main.dart -o site/test.wasm
24+
$ dart compile wasm web/main.dart -o site/test.wasm
2625

2726
For more details see documentation from https://dart.dev/web/wasm

example/wasm/site/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<title>Test ml dart wasm</title>
5-
<link rel="preload" href="/test.wasm" as="fetch" crossorigin>
5+
<link rel="preload" href="/site/test.wasm" as="fetch" crossorigin>
66
</head>
77
<body>
88
<h1>What iris is this ?</h1>
@@ -19,9 +19,9 @@ <h2>
1919
<div id="decisionTreeFull">decisionTreeFull: Not run yet.</div>
2020
</h2>
2121
<script type="module">
22-
const dartModulePromise = WebAssembly.compileStreaming(fetch('/test.wasm'));
22+
const dartModulePromise = WebAssembly.compileStreaming(fetch('/site/test.wasm'));
2323
const imports = {};
24-
let dart2wasm_runtime = await import('/test.mjs');
24+
let dart2wasm_runtime = await import('/site/test.mjs');
2525
let moduleInstance =
2626
await dart2wasm_runtime.instantiate(dartModulePromise, imports);
2727
dart2wasm_runtime.invoke(moduleInstance);
@@ -60,4 +60,4 @@ <h2>
6060
</div>
6161
</body>
6262

63-
</html>
63+
</html>

0 commit comments

Comments
 (0)