private async void Init(string model, object opt = null) { Hash = Helper.UIDGenerator(); JSReference = await Runtime.InvokeAsync <IJSInProcessObjectReference>("import", "./_content/BlazorML5/ml5ImageClassifier.js"); DotNet = DotNetObjectReference.Create(this); JSReference.InvokeVoid("initImageClassifierStrML5", Hash, DotNet, model, opt); }
public void Classify(ElementReference videoOrImageOrCanvas, int noOfClasses = 0) { if (noOfClasses == 0) { JSReference.InvokeVoid("imageClassifierClassify", Hash, DotNet, videoOrImageOrCanvas); } else { JSReference.InvokeVoid("imageClassifierClassify", Hash, DotNet, videoOrImageOrCanvas, noOfClasses); } }
public void Classify(object imageData, int noOfClasses = 0) { if (noOfClasses == 0) { JSReference.InvokeVoid("imageClassifierClassify", Hash, DotNet, imageData); } else { JSReference.InvokeVoid("imageClassifierClassify", Hash, DotNet, imageData, noOfClasses); } }
private void Destroy() { JSReference.InvokeVoid("destroyImageClassifier", Hash); }