Kube-node-red is aiming to integrate Kubeflow/Kubebeters with node-red, leveraging node-red's low-code modules, and using Kubeflow resources (e.g. Kubeflow pipeline, Kserve) to enhance its AI/ML ability.
snippet.js
Record the machine learning task code written in Python to modify the task process based on front-end input<example>.js
Node back-end logic and front-end input processing<example>.html
Node front-end logic and user configuration logic and user configuration
1.Machine learning tasks written in python are executed in kubeflow, and js strings are stored in constants for node calls and modifications.
const EXAMPLE =
`
data = pd.DataFrame(data, columns=col_names[:])
data.fillna(value=0, inplace=True)
data = data.values
`;
- The user-modified part will need to be replaced with the template literal value "%s"
` data.fillna(value=%s, inplace=True)
`
- Output this constant
module.exports = {
EXAMPLE,
};
- Import the "util" module and import the prepared snippet.js according to the file structure
const util = require('util');
const snippets = require('../snippets');
- Replace the user's front-end configuration with the target code
example = util.format(snippets.EXAMPLE,config.userinput)
- Store the modified code as a variable in the msg object attribute
node.on('input', function(msg) {
msg.payload += example
node.send(msg);
});
- Set relevant configurations according to machine learning task requirements
defaults: {
userinput: { value: {} }
},
2.Write corresponding html template
<div class="form-row">
<label for="node-input-userinput>UserInput</label>
<input type="text" id="node-input-userinput" />
</div>
https://github.com/NightLightTw/kube-nodered
https://github.com/kubeflow/pipelines/tree/1.8.21/backend/api/python_http_client