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

Function loadHostedPretrainedModel

mnist-transfer-cnn/loader.js:40–54  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

38 * @return An instance of `tf.Model` with model topology and weights loaded.
39 */
40export async function loadHostedPretrainedModel(url) {
41 ui.status('Loading pretrained model from ' + url);
42 try {
43 const model = await tf.loadLayersModel(url);
44 ui.status('Done loading pretrained model.');
45 // We can't load a model twice due to
46 // https://github.com/tensorflow/tfjs/issues/34
47 // Therefore we remove the load buttons to avoid user confusion.
48 ui.disableLoadModelButtons();
49 return model;
50 } catch (err) {
51 console.error(err);
52 ui.status('Loading pretrained model failed.');
53 }
54}
55
56/**
57 * Load data file stored at a remote URL.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected