Trailhead consists of creating a Dataset with the given URL(https://developer.salesforce.com/files/Cats.zip)
But how can we create our own Dataset, if we have all the images in Local system.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityTrailhead consists of creating a Dataset with the given URL(https://developer.salesforce.com/files/Cats.zip)
But how can we create our own Dataset, if we have all the images in Local system.
The trailhead module used a service class called EinsteinVision_PredictionService to get the data from the zip and then load it into the Einstein REST API..
public Einstein_Dataset createDatasetFromUrlAsync(String url) {
System.debug('Starting createDatasetFromUrlAsync call from URL ' + url + ' for type ' + typeString + '.');
Einstein_HttpBodyPartDatasetUrl parts = new Einstein_HttpBodyPartDatasetUrl(url, typeString);
Einstein_HttpClient client = new Einstein_HttpClient(this, '/datasets/upload', parts.build());
client.isPost(true);
System.debug('Target URL is ' + client.getUrl());
client.execute();
while(isExecuting()) {
System.debug('Status is: ' + isExecuting());
}
System.debug('Call createDatasetFromUrlAsync has been executed.');
if (!client.isError()) {
Einstein_Dataset dataset = (Einstein_Dataset)client.getParser().readValueAs(Einstein_Dataset.class);
System.debug('New dataset with id ' + dataset.id + ' has been created.');
return dataset;
}
handleError(client.getStatusCode(), client.getResponseError());
return null;
}
All the source code is here:
You can follow the Apex code example to understand how they have done it.
The Einstein REST API documentation will also help: