Following is the code to create a custom classifier from Watson API in Electron
export function uploadVRData(api_key, payload, dest) {
return (dispatch) => {
const formData = new FormData();
formData.append('name', payload.classifier);
payload.watsonTrainingSet.map((data) => {
formData.append(`${data.classLabel}_positive_examples`, new
Blob(fs.readFileSync(path.resolve(__dirname, `../../../../../..${data.zipPath}`))));
});
axios({
method: 'post',
url: 'https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers?version=2018-03-19',
data: formData,
config: {
headers: {
Origin: '',
},
},
auth: {
username: 'apikey',
password: '<my-api-key>',
},
}).then((res) => {
console.log(res);
}).catch((err1) => {
console.log(err1);
});
I get 200 response, but it later fails with this error
Cannot execute learning task. : Could not train classifier. Verify there are at least 10 positive training images for each class, and at least 10 other unique training images (inluding optional negative_examples). There is a minimum of 1 positive class. Not enough samples for training, class: (my-class-name) has only 0 samples
Although I am able to successfully create classifier through Postman. But from Electron it fails. Can anyone help me?