node-red-contrib-tfjs-pj1
Version:
custom Node-RED for classification
42 lines (39 loc) • 1.64 kB
HTML
<!-- Node-RED UI Definition -->
<script type="text/html" data-template-name="tfjs-pj1-node">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-modelUrl"><i class="fa fa-globe"></i> Model Url</label>
<input type="text" id="node-input-modelUrl" placeholder="http://192.168.1.18:8080/model.json">
</div>
<div class="form-row">
<label for="node-input-fromHub">Is TFHub?</label>
<input type="checkbox" id="node-input-fromHub" checked>
</div>
</script>
<!-- Node-RED JavaScript Registration Logic -->
<script type="text/javascript">
RED.nodes.registerType('tfjs-pj1-node', {
category: 'machine learning',
defaults: {
name: { value: 'tfjs pj1 node' },
modelUrl: { value: 'http://192.168.1.18:8080/model.json' },
fromHub: { value: 'checked' }
},
inputs: 1,
outputs: 1,
paletteLabel: 'tfjs pj1 node',
color: '#ff9100',
label: function() {
return this.name || 'tfjs pj1 node';
}
});
</script>
<!-- Node-RED Node Help Definition -->
<script type="text/html" data-help-name="tfjs-pj1-node">
<p>A TensorFlow.js node to run predictions for custom image classification.</p>
<p>Provide a <strong>Model Url</strong> and indicate whether the URL points to a TFHub hosted model.</p>
<p>The node accepts an image buffer and outputs a JSON prediction object with the detected class and its confidence score.</p>
</script>