interpreter.run(inputs, inputOutputOptions)
.addOnSuccessListener(
new OnSuccessListener<FirebaseModelOutputs>() {
@Override
public void onSuccess(FirebaseModelOutputs result) {
String str;
float[][] output = result.getOutput(0);
float[] probabilities = output[0];
float res=probabilities[0];
//Log.d(TAG, "onSuccess res: "+result.getOutput(0).toString());
System.out.println(output[0][0]);
System.out.println(output[0][1]);
if (output[0][0]>output[0][1]){
//till here my code is properly Running
str="Class1";
graphicOverlay.add(new FaceGraphic(graphicOverlay, face,str));
//But when i try to call this method this method not getting called same for else case
}
else {
//till here my code is properly Running
str="Class2";
}
}
})
.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
}
});
How can i get the value of of variable "str" in my main method?
I tried declaring string as a Static Class but it gives the last stored output(value of str is not updated as it changes)
Thankyou in advanced