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