MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / init

Function init

date-conversion-attention/index.js:102–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100}
101
102async function init() {
103 try {
104 status.textContent = `Loading model from ${RELATIVE_MODEL_URL} ...`;
105 model = await tf.loadLayersModel(RELATIVE_MODEL_URL);
106 } catch (err) {
107 // If loading of the local model has failed, try loading from the hosted
108 // model.
109 status.textContent = `Loading hosted model from ${HOSTED_MODEL_URL} ...`;
110 model = await tf.loadLayersModel(HOSTED_MODEL_URL);
111 }
112 status.textContent = 'Done loading model.';
113 model.summary();
114
115 const exampleItems = document.getElementsByClassName('input-date-example');
116 for (const exampleItem of exampleItems) {
117 exampleItem.addEventListener('click', (event) => {
118 inputDateString.value = event.srcElement.textContent;
119 inputDateString.dispatchEvent(new Event('change'));
120 });
121 }
122
123 inputDateString.dispatchEvent(new Event('change'));
124}
125
126init();

Callers 1

index.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected