@webwriter/deep-learning-model 0.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +8 -0
- package/LICENSE +7 -0
- package/README.md +290 -0
- package/components/dataset-input/dataset-input.styles.ts +20 -0
- package/components/dataset-input/dataset-input.ts +196 -0
- package/components/inference-fields/class-input.ts +83 -0
- package/components/inference-fields/class-output.ts +62 -0
- package/components/inference-fields/image-input.ts +182 -0
- package/components/inference-fields/image.ts +82 -0
- package/components/inference-fields/inference-interfaces.ts +15 -0
- package/components/inference-fields/number-input.ts +62 -0
- package/components/inference-fields/number-output.ts +56 -0
- package/components/model-editor.ts +288 -0
- package/components/model-tests/bad-samples.ts +152 -0
- package/components/model-tests/loss-distribution.ts +174 -0
- package/components/reference-element-select.ts +105 -0
- package/custom-elements.json +1470 -0
- package/custom.d.ts +180 -0
- package/dist/widgets/webwriter-feature-engineering.css +444 -0
- package/dist/widgets/webwriter-feature-engineering.js +112763 -0
- package/dist/widgets/webwriter-model-designing.css +444 -0
- package/dist/widgets/webwriter-model-designing.js +114587 -0
- package/dist/widgets/webwriter-model-evaluation.css +444 -0
- package/dist/widgets/webwriter-model-evaluation.js +119010 -0
- package/dist/widgets/webwriter-model-prediction.css +444 -0
- package/dist/widgets/webwriter-model-prediction.js +109251 -0
- package/dist/widgets/webwriter-model-training.css +444 -0
- package/dist/widgets/webwriter-model-training.js +121465 -0
- package/editing-config.json +73 -0
- package/icon.svg +1 -0
- package/lib/dataset/class.ts +155 -0
- package/lib/dataset/dataset.ts +293 -0
- package/lib/dataset/feature.ts +110 -0
- package/lib/dataset/image.ts +312 -0
- package/lib/dataset/linear.ts +120 -0
- package/lib/layers/activation.ts +48 -0
- package/lib/layers/add.ts +50 -0
- package/lib/layers/attention.ts +74 -0
- package/lib/layers/concat.ts +50 -0
- package/lib/layers/conv.ts +83 -0
- package/lib/layers/dropout.ts +44 -0
- package/lib/layers/fcl.ts +66 -0
- package/lib/layers/flatten.ts +48 -0
- package/lib/layers/index.ts +770 -0
- package/lib/layers/input.ts +55 -0
- package/lib/layers/noise.ts +43 -0
- package/lib/layers/output.ts +64 -0
- package/lib/layers/reshape.ts +76 -0
- package/lib/layers/transposeconv.ts +90 -0
- package/lib/tflib.ts +10 -0
- package/lit-localize.json +47 -0
- package/localization/ar.xlf +553 -0
- package/localization/bg.xlf +552 -0
- package/localization/cs.xlf +553 -0
- package/localization/da.xlf +552 -0
- package/localization/de.xlf +552 -0
- package/localization/el.xlf +554 -0
- package/localization/es.xlf +553 -0
- package/localization/et.xlf +553 -0
- package/localization/fi.xlf +552 -0
- package/localization/fr.xlf +553 -0
- package/localization/generated/ar.ts +159 -0
- package/localization/generated/bg.ts +158 -0
- package/localization/generated/cs.ts +159 -0
- package/localization/generated/da.ts +158 -0
- package/localization/generated/de.ts +158 -0
- package/localization/generated/el.ts +160 -0
- package/localization/generated/es.ts +159 -0
- package/localization/generated/et.ts +159 -0
- package/localization/generated/fi.ts +158 -0
- package/localization/generated/fr.ts +159 -0
- package/localization/generated/hu.ts +158 -0
- package/localization/generated/id.ts +159 -0
- package/localization/generated/index.js +3 -0
- package/localization/generated/it.ts +159 -0
- package/localization/generated/ja.ts +158 -0
- package/localization/generated/ko.ts +158 -0
- package/localization/generated/locale-codes.js +83 -0
- package/localization/generated/lt.ts +158 -0
- package/localization/generated/lv.ts +158 -0
- package/localization/generated/nb.ts +158 -0
- package/localization/generated/nl.ts +158 -0
- package/localization/generated/pl.ts +159 -0
- package/localization/generated/pt-BR.ts +159 -0
- package/localization/generated/pt-PT.ts +159 -0
- package/localization/generated/ro.ts +159 -0
- package/localization/generated/ru.ts +159 -0
- package/localization/generated/sk.ts +159 -0
- package/localization/generated/sl.ts +159 -0
- package/localization/generated/sv.ts +158 -0
- package/localization/generated/tr.ts +158 -0
- package/localization/generated/uk.ts +158 -0
- package/localization/generated/zh-hans.ts +141 -0
- package/localization/generated/zh-hant.ts +141 -0
- package/localization/hu.xlf +552 -0
- package/localization/id.xlf +553 -0
- package/localization/it.xlf +553 -0
- package/localization/ja.xlf +552 -0
- package/localization/ko.xlf +552 -0
- package/localization/lt.xlf +552 -0
- package/localization/lv.xlf +552 -0
- package/localization/nb.xlf +552 -0
- package/localization/nl.xlf +552 -0
- package/localization/pkg/ar.xliff +7 -0
- package/localization/pkg/bg.xliff +7 -0
- package/localization/pkg/cs.xliff +7 -0
- package/localization/pkg/da.xliff +7 -0
- package/localization/pkg/de.xliff +7 -0
- package/localization/pkg/el.xliff +7 -0
- package/localization/pkg/es.xliff +7 -0
- package/localization/pkg/et.xliff +7 -0
- package/localization/pkg/fi.xliff +7 -0
- package/localization/pkg/fr.xliff +7 -0
- package/localization/pkg/hu.xliff +7 -0
- package/localization/pkg/id.xliff +7 -0
- package/localization/pkg/it.xliff +7 -0
- package/localization/pkg/ja.xliff +7 -0
- package/localization/pkg/ko.xliff +7 -0
- package/localization/pkg/lt.xliff +7 -0
- package/localization/pkg/lv.xliff +7 -0
- package/localization/pkg/nb.xliff +7 -0
- package/localization/pkg/nl.xliff +7 -0
- package/localization/pkg/pl.xliff +7 -0
- package/localization/pkg/pt-BR.xliff +7 -0
- package/localization/pkg/pt-PT.xliff +7 -0
- package/localization/pkg/ro.xliff +7 -0
- package/localization/pkg/ru.xliff +7 -0
- package/localization/pkg/sk.xliff +7 -0
- package/localization/pkg/sl.xliff +7 -0
- package/localization/pkg/sv.xliff +7 -0
- package/localization/pkg/tr.xliff +7 -0
- package/localization/pkg/uk.xliff +7 -0
- package/localization/pkg/zh-hans.xliff +7 -0
- package/localization/pkg/zh-hant.xliff +7 -0
- package/localization/pl.xlf +553 -0
- package/localization/pt-BR.xlf +553 -0
- package/localization/pt-PT.xlf +553 -0
- package/localization/ro.xlf +553 -0
- package/localization/ru.xlf +553 -0
- package/localization/sk.xlf +553 -0
- package/localization/sl.xlf +553 -0
- package/localization/snippets/ar.xliff +16 -0
- package/localization/snippets/bg.xliff +16 -0
- package/localization/snippets/cs.xliff +16 -0
- package/localization/snippets/da.xliff +16 -0
- package/localization/snippets/de.xliff +16 -0
- package/localization/snippets/el.xliff +16 -0
- package/localization/snippets/es.xliff +16 -0
- package/localization/snippets/et.xliff +16 -0
- package/localization/snippets/fi.xliff +16 -0
- package/localization/snippets/fr.xliff +16 -0
- package/localization/snippets/hu.xliff +16 -0
- package/localization/snippets/id.xliff +16 -0
- package/localization/snippets/it.xliff +16 -0
- package/localization/snippets/ja.xliff +16 -0
- package/localization/snippets/ko.xliff +16 -0
- package/localization/snippets/lt.xliff +16 -0
- package/localization/snippets/lv.xliff +16 -0
- package/localization/snippets/nb.xliff +16 -0
- package/localization/snippets/nl.xliff +16 -0
- package/localization/snippets/pl.xliff +16 -0
- package/localization/snippets/pt-BR.xliff +16 -0
- package/localization/snippets/pt-PT.xliff +16 -0
- package/localization/snippets/ro.xliff +16 -0
- package/localization/snippets/ru.xliff +16 -0
- package/localization/snippets/sk.xliff +16 -0
- package/localization/snippets/sl.xliff +16 -0
- package/localization/snippets/sv.xliff +16 -0
- package/localization/snippets/tr.xliff +16 -0
- package/localization/snippets/uk.xliff +16 -0
- package/localization/snippets/zh-hans.xliff +16 -0
- package/localization/snippets/zh-hant.xliff +16 -0
- package/localization/sv.xlf +552 -0
- package/localization/tr.xlf +552 -0
- package/localization/uk.xlf +552 -0
- package/localization/zh-hans.xlf +552 -0
- package/localization/zh-hant.xlf +552 -0
- package/package.json +103 -2
- package/snippets/MNIST.html +21 -0
- package/test.json +63 -0
- package/tsconfig.json +8 -0
- package/widgets/webwriter-feature-engineering.ts +421 -0
- package/widgets/webwriter-model-designing.ts +323 -0
- package/widgets/webwriter-model-evaluation.ts +215 -0
- package/widgets/webwriter-model-prediction.ts +307 -0
- package/widgets/webwriter-model-training.ts +709 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 Matthias Schäfer
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# Deep Learning Model (`@webwriter/deep-learning-model@1.0.2`)
|
|
2
|
+
[License: MIT](LICENSE) | Version: 1.0.2
|
|
3
|
+
|
|
4
|
+
A set of blocks to create, train and evaluate deep learning models.
|
|
5
|
+
|
|
6
|
+
## Snippets
|
|
7
|
+
[Snippets](https://webwriter.app/docs/snippets/snippets/) are examples and templates using the package's widgets.
|
|
8
|
+
|
|
9
|
+
| Name | Import Path |
|
|
10
|
+
| :--: | :---------: |
|
|
11
|
+
| MNIST Image To Number | `@webwriter/deep-learning-model/snippets/MNIST-Image-to-Number.html` |
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## `AiWidgetsFeatures` (`<webwriter-feature-engineering>`)
|
|
16
|
+
A widget that allows feature engineering on a dataset
|
|
17
|
+
|
|
18
|
+
### Usage
|
|
19
|
+
|
|
20
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
21
|
+
```html
|
|
22
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-feature-engineering.css" rel="stylesheet">
|
|
23
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-feature-engineering.js"></script>
|
|
24
|
+
<webwriter-feature-engineering></webwriter-feature-engineering>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
npm install @webwriter/deep-learning-model
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<link href="@webwriter/deep-learning-model/widgets/webwriter-feature-engineering.css" rel="stylesheet">
|
|
35
|
+
<script type="module" src="@webwriter/deep-learning-model/widgets/webwriter-feature-engineering.js"></script>
|
|
36
|
+
<webwriter-feature-engineering></webwriter-feature-engineering>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Fields
|
|
40
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
41
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
42
|
+
| `samplesSave` (`samplesSave`) | `string` | The original decompressed data in a json string with format of RawSample[] | - | ✓ |
|
|
43
|
+
| `fieldProps` (`fieldProps`) | `Record<string, FieldProp>` | Stores the settings of the feature columns | - | ✓ |
|
|
44
|
+
| `limit` (`limit`) | `number` | The number of samples used for the dataset | `1000` | ✓ |
|
|
45
|
+
| `editMode` (`editMode`) | `"edit"\|"feat"\|"read"\|"hidden"` | What students will be able to edit in the explorable. Ranging from "edit" = everything, "feat" = only feature settings, "read" = read only, to "hidden" = invisible to the students. | `"edit"` | ✓ |
|
|
46
|
+
|
|
47
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
48
|
+
|
|
49
|
+
## Methods
|
|
50
|
+
| Name | Description | Parameters |
|
|
51
|
+
| :--: | :---------: | :-------: |
|
|
52
|
+
| `getDataset` | Returns the current dataset in both raw and tensor form | -
|
|
53
|
+
| `isReady` | Checks whether the dataset is ready to be used | -
|
|
54
|
+
|
|
55
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
56
|
+
|
|
57
|
+
## Events
|
|
58
|
+
| Name | Description |
|
|
59
|
+
| :--: | :---------: |
|
|
60
|
+
| change | Fired when the dataset changes. Detail contains { dataset: Dataset, tensorDataset: TransformedDataset } |
|
|
61
|
+
|
|
62
|
+
*[Events](https://developer.mozilla.org/en-US/docs/Web/Events) are dispatched by the widget after certain triggers.*
|
|
63
|
+
|
|
64
|
+
## Editing config
|
|
65
|
+
| Name | Value |
|
|
66
|
+
| :--: | :---------: |
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
70
|
+
|
|
71
|
+
*No public slots, custom CSS properties, or CSS parts.*
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## `AiWidgetsDesigns` (`<webwriter-model-designing>`)
|
|
75
|
+
A widget to design AI models using a visual editor.
|
|
76
|
+
|
|
77
|
+
### Usage
|
|
78
|
+
|
|
79
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
80
|
+
```html
|
|
81
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-designing.css" rel="stylesheet">
|
|
82
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-designing.js"></script>
|
|
83
|
+
<webwriter-model-designing></webwriter-model-designing>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
npm install @webwriter/deep-learning-model
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<link href="@webwriter/deep-learning-model/widgets/webwriter-model-designing.css" rel="stylesheet">
|
|
94
|
+
<script type="module" src="@webwriter/deep-learning-model/widgets/webwriter-model-designing.js"></script>
|
|
95
|
+
<webwriter-model-designing></webwriter-model-designing>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Fields
|
|
99
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
100
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
101
|
+
| `state` (`state`) | `string` | Stores the state of the model editor as a json string | - | ✓ |
|
|
102
|
+
| `featureWidgetId` (`featureWidgetId`) | `string` | Stores the reference id of the widget where the dataset is used from | - | ✓ |
|
|
103
|
+
| `editMode` (`editMode`) | `"edit"\|"layer"\|"read"\|"hidden"` | What students will be able to edit in the explorable. Ranging from "edit" = everything, "layer" = only layer settings, "read" = read only, to "hidden" = invisible to the students. | `"edit"` | ✓ |
|
|
104
|
+
| `maxModelParameters` (`maxModelParameters`) | `number` | The maximum number of total parameters allowed for training the model. Only checked by the training widget. | `100000` | ✓ |
|
|
105
|
+
| `maxLayerParameters` (`maxLayerParameters`) | `number` | The maximum number of parameters allowed per layer to allow training the model. | `10000` | ✓ |
|
|
106
|
+
| `currentCanvas` | `ModelEditor` | Reference to the current model editor canvas | - | ✗ |
|
|
107
|
+
|
|
108
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
109
|
+
|
|
110
|
+
## Methods
|
|
111
|
+
| Name | Description | Parameters |
|
|
112
|
+
| :--: | :---------: | :-------: |
|
|
113
|
+
| `zoomIn` | Zoom the canvas in | -
|
|
114
|
+
| `zoomOut` | Zoom the canvas out | -
|
|
115
|
+
| `zoomReset` | Reset the zoom of the canvas | -
|
|
116
|
+
| `getModel` | Exports the current model design | -
|
|
117
|
+
|
|
118
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
119
|
+
|
|
120
|
+
## Editing config
|
|
121
|
+
| Name | Value |
|
|
122
|
+
| :--: | :---------: |
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
126
|
+
|
|
127
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## `AiWidgetsTraining` (`<webwriter-model-training>`)
|
|
131
|
+
A widget to train models designed in the model designing widget using datasets created in the feature engineering widget.
|
|
132
|
+
|
|
133
|
+
### Usage
|
|
134
|
+
|
|
135
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
136
|
+
```html
|
|
137
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-training.css" rel="stylesheet">
|
|
138
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-training.js"></script>
|
|
139
|
+
<webwriter-model-training></webwriter-model-training>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
npm install @webwriter/deep-learning-model
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<link href="@webwriter/deep-learning-model/widgets/webwriter-model-training.css" rel="stylesheet">
|
|
150
|
+
<script type="module" src="@webwriter/deep-learning-model/widgets/webwriter-model-training.js"></script>
|
|
151
|
+
<webwriter-model-training></webwriter-model-training>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Fields
|
|
155
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
156
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
157
|
+
| `featureWidgetId` (`featureWidgetId`) | `string` | The feature engineering widget to use as data source for training the model. | - | ✓ |
|
|
158
|
+
| `modelWidgetId` (`modelWidgetId`) | `string` | The model design widget to use as model source for training. | - | ✓ |
|
|
159
|
+
| `cache` (`cache`) | `boolean` | If true, the transformed training samples will be cached for faster training. | - | ✓ |
|
|
160
|
+
| `currentBackend` (`currentBackend`) | `"webgl" \| "cpu"` | The prefered tfjs backend | `"webgl"` | ✓ |
|
|
161
|
+
| `modelVersions` (`modelVersions`) | `Record<string, string>` | Stores the model jsons with a name like "best" or "epoch-20" for loading by the inference and test widgets | `{}` | ✓ |
|
|
162
|
+
| `editMode` (`editMode`) | `"edit"\|"hidden"` | "edit" means that students can use the widget to train a model while "hidden" means the widget will be invisible to student but the trained models can be used by other widgets. | `"edit"` | ✓ |
|
|
163
|
+
|
|
164
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
165
|
+
|
|
166
|
+
## Methods
|
|
167
|
+
| Name | Description | Parameters |
|
|
168
|
+
| :--: | :---------: | :-------: |
|
|
169
|
+
| `resolveOutput` | Used to recursively connect the inputs via the layers to the output nodes. | `layer: Layer`, `inputs: Record<string, TF.SymbolicTensor>`, `resolvedLayers: Record<number, any>`
|
|
170
|
+
| `buildModel` | Builds the complete tfjs model using the layers from the model design widget. It sets the correct input names for the input layers as "in_<feature>". The output layers dependency graph is build and the loss is applied to the output tensor for training. | -
|
|
171
|
+
| `lossStringToFunction` | Converts a loss string to the corresponding tfjs loss function. | `loss: string`
|
|
172
|
+
| `getModel` | Returns the model for named checkpoints for other widgets to use. | `name`
|
|
173
|
+
| `getAvailableModels` | Returns the available model checkpoints | -
|
|
174
|
+
| `initModel` | Initializes the model for training and preps the UI. | -
|
|
175
|
+
| `training` | Runs the tf training loop and keeps the UI up-to-date | -
|
|
176
|
+
| `saveCurrentModel` | Saves the current model as a checkpoint for other widgets to use later. | `name`
|
|
177
|
+
|
|
178
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
179
|
+
|
|
180
|
+
## Events
|
|
181
|
+
| Name | Description |
|
|
182
|
+
| :--: | :---------: |
|
|
183
|
+
| finished | Fired when the training process has finished. |
|
|
184
|
+
| epoch | Fired after each epoch during training. |
|
|
185
|
+
|
|
186
|
+
*[Events](https://developer.mozilla.org/en-US/docs/Web/Events) are dispatched by the widget after certain triggers.*
|
|
187
|
+
|
|
188
|
+
## Editing config
|
|
189
|
+
| Name | Value |
|
|
190
|
+
| :--: | :---------: |
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
194
|
+
|
|
195
|
+
*No public slots, custom CSS properties, or CSS parts.*
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## `AiWidgetsInference` (`<webwriter-model-prediction>`)
|
|
199
|
+
A widget to run inference using a trained model and features created in the feature engineering widget.
|
|
200
|
+
|
|
201
|
+
### Usage
|
|
202
|
+
|
|
203
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
204
|
+
```html
|
|
205
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-prediction.css" rel="stylesheet">
|
|
206
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-prediction.js"></script>
|
|
207
|
+
<webwriter-model-prediction></webwriter-model-prediction>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
npm install @webwriter/deep-learning-model
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```html
|
|
217
|
+
<link href="@webwriter/deep-learning-model/widgets/webwriter-model-prediction.css" rel="stylesheet">
|
|
218
|
+
<script type="module" src="@webwriter/deep-learning-model/widgets/webwriter-model-prediction.js"></script>
|
|
219
|
+
<webwriter-model-prediction></webwriter-model-prediction>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Fields
|
|
223
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
224
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
225
|
+
| `featureWidgetId` (`featureWidgetId`) | `string` | The id of the feature engineering widget to use as input. | - | ✓ |
|
|
226
|
+
| `modelWidgetId` (`modelWidgetId`) | `string` | The id of the model training widget to use as model source. | - | ✓ |
|
|
227
|
+
|
|
228
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
229
|
+
|
|
230
|
+
## Editing config
|
|
231
|
+
| Name | Value |
|
|
232
|
+
| :--: | :---------: |
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
236
|
+
|
|
237
|
+
*No public methods, slots, events, custom CSS properties, or CSS parts.*
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
## `AiWidgetsTest` (`<webwriter-model-evaluation>`)
|
|
241
|
+
A widget that allows evaluating a trained model using various tests.
|
|
242
|
+
|
|
243
|
+
### Usage
|
|
244
|
+
|
|
245
|
+
Use with a CDN (e.g. [jsdelivr](https://jsdelivr.com)):
|
|
246
|
+
```html
|
|
247
|
+
<link href="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-evaluation.css" rel="stylesheet">
|
|
248
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/deep-learning-model/widgets/webwriter-model-evaluation.js"></script>
|
|
249
|
+
<webwriter-model-evaluation></webwriter-model-evaluation>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Or use with a bundler (e.g. [Vite](https://vite.dev)):
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
npm install @webwriter/deep-learning-model
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```html
|
|
259
|
+
<link href="@webwriter/deep-learning-model/widgets/webwriter-model-evaluation.css" rel="stylesheet">
|
|
260
|
+
<script type="module" src="@webwriter/deep-learning-model/widgets/webwriter-model-evaluation.js"></script>
|
|
261
|
+
<webwriter-model-evaluation></webwriter-model-evaluation>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Fields
|
|
265
|
+
| Name (Attribute Name) | Type | Description | Default | Reflects |
|
|
266
|
+
| :-------------------: | :--: | :---------: | :-----: | :------: |
|
|
267
|
+
| `featureWidgetId` (`featureWidgetId`) | `string` | The id of the feature engineering widget to use as feature source. | - | ✓ |
|
|
268
|
+
| `modelWidgetId` (`modelWidgetId`) | `string` | The id of the model training widget to use as model source. | - | ✓ |
|
|
269
|
+
|
|
270
|
+
*Fields including [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) and [attributes](https://developer.mozilla.org/en-US/docs/Glossary/Attribute) define the current state of the widget and offer customization options.*
|
|
271
|
+
|
|
272
|
+
## Methods
|
|
273
|
+
| Name | Description | Parameters |
|
|
274
|
+
| :--: | :---------: | :-------: |
|
|
275
|
+
| `getModelSelect` | Renders the model select field allowing the user to change the model checkpoint that is used for testing. | -
|
|
276
|
+
|
|
277
|
+
*[Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) allow programmatic access to the widget.*
|
|
278
|
+
|
|
279
|
+
## Editing config
|
|
280
|
+
| Name | Value |
|
|
281
|
+
| :--: | :---------: |
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
*The [editing config](https://webwriter.app/docs/packages/configuring/#editingconfig) defines how explorable authoring tools such as [WebWriter](https://webwriter.app) treat the widget.*
|
|
285
|
+
|
|
286
|
+
*No public slots, events, custom CSS properties, or CSS parts.*
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
*Generated with @webwriter/build@1.9.1*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
.overlay {
|
|
5
|
+
position: absolute; /* To overlay the .page div */
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
background-color: rgba(0, 0, 0, 0.8); /* Black background with opacity */
|
|
11
|
+
display: flex; /* Flexbox for centering */
|
|
12
|
+
justify-content: center; /* Center horizontally */
|
|
13
|
+
align-items: center; /* Center vertically */
|
|
14
|
+
z-index: 100;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#file-input-label:hover {
|
|
18
|
+
color: blue;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { msg } from "@lit/localize";
|
|
2
|
+
import { html } from "lit";
|
|
3
|
+
|
|
4
|
+
import { LitElementWw } from "@webwriter/lit";
|
|
5
|
+
import { asyncBufferFromUrl, parquetReadObjects } from 'hyparquet';
|
|
6
|
+
import Papa from "papaparse";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
SlButton,
|
|
10
|
+
SlCheckbox,
|
|
11
|
+
SlIcon,
|
|
12
|
+
SlInput,
|
|
13
|
+
} from "@shoelace-style/shoelace";
|
|
14
|
+
import "@shoelace-style/shoelace/dist/themes/light.css";
|
|
15
|
+
|
|
16
|
+
import styles from "./dataset-input.styles";
|
|
17
|
+
|
|
18
|
+
//Tabler
|
|
19
|
+
import file from "@tabler/icons/outline/file.svg";
|
|
20
|
+
|
|
21
|
+
export class DatasetInput extends LitElementWw {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns an object that maps custom element names to their corresponding classes.
|
|
25
|
+
* These custom elements can be used within the scope of the `webwriter-interactive-video` component.
|
|
26
|
+
*
|
|
27
|
+
* @returns An object mapping custom element names to their corresponding classes.
|
|
28
|
+
*/
|
|
29
|
+
static get scopedElements() {
|
|
30
|
+
return {
|
|
31
|
+
"sl-checkbox": SlCheckbox,
|
|
32
|
+
"sl-input": SlInput,
|
|
33
|
+
"sl-icon": SlIcon,
|
|
34
|
+
"sl-button": SlButton,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//import CSS
|
|
39
|
+
static styles = [styles];
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
firstUpdated() { }
|
|
46
|
+
|
|
47
|
+
render() {
|
|
48
|
+
return html` <div
|
|
49
|
+
class="overlay"
|
|
50
|
+
style="display: flex;
|
|
51
|
+
flex-direction: column;"
|
|
52
|
+
>
|
|
53
|
+
<sl-button
|
|
54
|
+
variant="default"
|
|
55
|
+
style="width: 20%"
|
|
56
|
+
@click=${this.triggerFileInput}
|
|
57
|
+
@dragover=${this.handleDragOverFileInputArea}
|
|
58
|
+
@drop=${this.handleDropOnFileInputArea}
|
|
59
|
+
>
|
|
60
|
+
<sl-icon slot="prefix" src=${file}></sl-icon>
|
|
61
|
+
${msg("Select Dataset")}
|
|
62
|
+
<input
|
|
63
|
+
name="fileInput"
|
|
64
|
+
id="fileInput"
|
|
65
|
+
type="file"
|
|
66
|
+
accept="text/csv, application/json, text/json, *"
|
|
67
|
+
@change=${this.handleFileInput}
|
|
68
|
+
style="display: none;"
|
|
69
|
+
/>
|
|
70
|
+
</sl-button>
|
|
71
|
+
</div>`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private recursiveFlatten(obj, name) {
|
|
75
|
+
if (obj == null)
|
|
76
|
+
return null;
|
|
77
|
+
if (obj.constructor == null || obj.constructor.name != "Object")
|
|
78
|
+
return obj;
|
|
79
|
+
|
|
80
|
+
let out = {};
|
|
81
|
+
for (let field in obj) {
|
|
82
|
+
let flattenedField = this.recursiveFlatten(obj[field], field);
|
|
83
|
+
if (flattenedField == null)
|
|
84
|
+
continue;
|
|
85
|
+
if (flattenedField.constructor != null && flattenedField.constructor.name == "Object") {
|
|
86
|
+
for (let flat in flattenedField) {
|
|
87
|
+
out[name ? name + "_" + flat : flat] = flattenedField[flat];
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
out[name ? name + "_" + field : field] = flattenedField;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
async readParquetFile(file: File): Promise<Array<Record<string, any>>> {
|
|
98
|
+
let url = URL.createObjectURL(file);
|
|
99
|
+
let buffer = await asyncBufferFromUrl({ url, byteLength: file.size });
|
|
100
|
+
let data = await parquetReadObjects({ file: buffer, utf8: false });
|
|
101
|
+
return data.map(entry => this.recursiveFlatten(entry, null));
|
|
102
|
+
}
|
|
103
|
+
async readCSVFile(file: File): Promise<Array<Record<string, any>>> {
|
|
104
|
+
return new Promise(function (res, rej) {
|
|
105
|
+
Papa.parse(file, {
|
|
106
|
+
header: true,
|
|
107
|
+
skipEmptyLines: "greedy",
|
|
108
|
+
complete: function (results) {
|
|
109
|
+
res(results);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
async readJSONFile(file: File): Promise<Array<Record<string, any>>> {
|
|
115
|
+
return JSON.parse(await file.text());
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
triggerFileInput() {
|
|
120
|
+
const fileInput =
|
|
121
|
+
this.shadowRoot?.getElementById("fileInput") ||
|
|
122
|
+
document.getElementById("fileInput");
|
|
123
|
+
if (fileInput) {
|
|
124
|
+
fileInput.click();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Handles the drag over event for the file input area.
|
|
130
|
+
* @param e - The drag event.
|
|
131
|
+
*/
|
|
132
|
+
handleDragOverFileInputArea(e: DragEvent) {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
e.stopPropagation();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Handles the drop event on the file input area.
|
|
139
|
+
*
|
|
140
|
+
* @param e - The drag event.
|
|
141
|
+
*/
|
|
142
|
+
handleDropOnFileInputArea(e: DragEvent) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
const files = e.dataTransfer?.files;
|
|
146
|
+
if (files && files.length > 0) {
|
|
147
|
+
this.handleFile(files[0]);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Handles the file input event.
|
|
153
|
+
*
|
|
154
|
+
* @param e - The event object.
|
|
155
|
+
*/
|
|
156
|
+
handleFileInput(e: Event) {
|
|
157
|
+
const fileInput = e.target as HTMLInputElement;
|
|
158
|
+
const file = fileInput.files?.[0];
|
|
159
|
+
if (file) {
|
|
160
|
+
this.handleFile(file);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Handles the selected file and reads its contents and converts them into samples with keyed entries.
|
|
166
|
+
* @param file - The file to be handled.
|
|
167
|
+
*/
|
|
168
|
+
async handleFile(file: File) {
|
|
169
|
+
let that = this;
|
|
170
|
+
let data = null;
|
|
171
|
+
if (file.name.endsWith("parquet")) {
|
|
172
|
+
let content = await this.readParquetFile(file);
|
|
173
|
+
for (let row of content) {
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
let fields = Object.keys(content[0]);
|
|
177
|
+
let errors = [];
|
|
178
|
+
data = { data: content, errors, meta: { fields } };
|
|
179
|
+
} else if (file.name.endsWith("csv")) {
|
|
180
|
+
data = await this.readCSVFile(file);
|
|
181
|
+
} else if (file.name.endsWith("json")) {
|
|
182
|
+
data = {data: await this.readJSONFile(file)};
|
|
183
|
+
data.meta = {fields:Object.keys(data.data[0])};
|
|
184
|
+
data.errors = [];
|
|
185
|
+
} else {
|
|
186
|
+
console.error("Unsupported file type:", file.type);
|
|
187
|
+
}
|
|
188
|
+
this.dispatchEvent(
|
|
189
|
+
new CustomEvent("readDataset", {
|
|
190
|
+
detail: { ...data },
|
|
191
|
+
bubbles: true,
|
|
192
|
+
composed: true,
|
|
193
|
+
})
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { SlOption, SlSelect } from "@shoelace-style/shoelace";
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { property, query } from 'lit/decorators.js';
|
|
4
|
+
import ClassTransformation from '../../lib/dataset/class';
|
|
5
|
+
import { OutputElement } from './inference-interfaces';
|
|
6
|
+
|
|
7
|
+
import type * as TF from "@tensorflow/tfjs";
|
|
8
|
+
import getTF from "../../lib/tflib";
|
|
9
|
+
let tf: typeof TF;
|
|
10
|
+
(async () => {tf = await getTF()})()
|
|
11
|
+
|
|
12
|
+
export class ClassInput extends OutputElement {
|
|
13
|
+
static scopedElements = {
|
|
14
|
+
"sl-select": SlSelect,
|
|
15
|
+
"sl-option": SlOption
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static styles = css`
|
|
19
|
+
:host {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: inline-block;
|
|
22
|
+
touch-action: none;
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
table {
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
.class {
|
|
29
|
+
width: 30px;
|
|
30
|
+
}
|
|
31
|
+
canvas {
|
|
32
|
+
background: white;
|
|
33
|
+
border: 1px solid #ccc;
|
|
34
|
+
touch-action: none;
|
|
35
|
+
image-rendering: pixelated; /* Makes low-res canvas look better */
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
@property({
|
|
40
|
+
type: Array,
|
|
41
|
+
converter: {
|
|
42
|
+
fromAttribute(value) {
|
|
43
|
+
return JSON.parse(value);
|
|
44
|
+
},
|
|
45
|
+
toAttribute(value) {
|
|
46
|
+
return JSON.stringify(value);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
accessor classes: string[];
|
|
51
|
+
|
|
52
|
+
@property({
|
|
53
|
+
type: Boolean,
|
|
54
|
+
converter: {
|
|
55
|
+
fromAttribute(value) {
|
|
56
|
+
return value == "true";
|
|
57
|
+
},
|
|
58
|
+
toAttribute(value) {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
accessor multi = false;
|
|
64
|
+
|
|
65
|
+
@query("#input")
|
|
66
|
+
accessor input: SlSelect;
|
|
67
|
+
|
|
68
|
+
public async setTensor(tensor: TF.Tensor1D, transform: ClassTransformation) {
|
|
69
|
+
let clazz = await transform.inverse(tensor);
|
|
70
|
+
if (clazz.startsWith("["))
|
|
71
|
+
clazz = JSON.parse(clazz);
|
|
72
|
+
this.input.value = clazz;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public async getTensor(transform: ClassTransformation): Promise<TF.Tensor> {
|
|
76
|
+
let tensor = await transform.transform(this.input.value as string);
|
|
77
|
+
return tensor;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
render() {
|
|
81
|
+
return html`<sl-select id="input" ?multiple=${this.multi} value=${this.classes[0]}>${this.classes.map(c => html`<sl-option value=${c}>${c}</sl-option>`)}</sl-select>`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SlProgressBar } from "@shoelace-style/shoelace";
|
|
2
|
+
import { css, html, TemplateResult } from 'lit';
|
|
3
|
+
import ClassTransformation from '../../lib/dataset/class';
|
|
4
|
+
import { OutputElement } from './inference-interfaces';
|
|
5
|
+
|
|
6
|
+
import type * as TF from "@tensorflow/tfjs";
|
|
7
|
+
import getTF from "../../lib/tflib";
|
|
8
|
+
let tf: typeof TF;
|
|
9
|
+
(async () => {tf = await getTF()})()
|
|
10
|
+
|
|
11
|
+
export class ClassTable extends OutputElement {
|
|
12
|
+
static scopedElements = {
|
|
13
|
+
"sl-progress-bar": SlProgressBar
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static styles = css`
|
|
17
|
+
:host {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
touch-action: none;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
table {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
.class {
|
|
27
|
+
width: 30px;
|
|
28
|
+
}
|
|
29
|
+
canvas {
|
|
30
|
+
background: white;
|
|
31
|
+
border: 1px solid #ccc;
|
|
32
|
+
touch-action: none;
|
|
33
|
+
image-rendering: pixelated; /* Makes low-res canvas look better */
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
private table: TemplateResult;
|
|
38
|
+
|
|
39
|
+
public async setTensor(tensor: TF.Tensor, transform: ClassTransformation) {
|
|
40
|
+
let probs = tf.tidy(() => {
|
|
41
|
+
return tensor.clipByValue(0,1).squeeze().arraySync();
|
|
42
|
+
})
|
|
43
|
+
let entries = [];
|
|
44
|
+
let classes = transform.getClasses();
|
|
45
|
+
for (let i = 0; i < classes.length; i++) {
|
|
46
|
+
entries.push({prob: probs[i], clazz: classes[i]});
|
|
47
|
+
}
|
|
48
|
+
entries.sort((e1, e2) => e2.prob - e1.prob);
|
|
49
|
+
entries = entries.slice(0, 10);
|
|
50
|
+
|
|
51
|
+
let rows = [];
|
|
52
|
+
for (let e of entries) {
|
|
53
|
+
rows.push(html`<tr><td class="class">${e.clazz}</td><td><sl-progress-bar value=${e.prob * 100} title=${e.clazz + " (" + (e.prob * 100).toFixed(1) + "%)"}></sl-progress-bar></td></tr>`)
|
|
54
|
+
}
|
|
55
|
+
this.table = html`<table>${rows}</table>`
|
|
56
|
+
this.requestUpdate();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
render() {
|
|
60
|
+
return html`${this.table}`;
|
|
61
|
+
}
|
|
62
|
+
}
|