According to spec for working with ML on android devices I have uploaded my custom model on https://console.firebase.google.com/project and have written teh following android app code:
public class ImportUnFuncModel {
private Interpreter interpreter = null;
private static final String TAG = "ImportUnFuncModel";
public ImportUnFuncModel() {
CustomModelDownloadConditions conditions = new CustomModelDownloadConditions.Builder()
.requireWifi()
.build();
FirebaseModelDownloader.getInstance()
.getModel("FindFunc",DownloadType.LOCAL_MODEL, conditions)
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i(TAG, "onFailure exeption : " + e.toString());
}
})
.addOnSuccessListener(new OnSuccessListener<CustomModel>() {
@Override
public void onSuccess(CustomModel model) {
Log.i(TAG, "onSuccess model : " + model.toString());
File modelFile = model.getFile();
if (modelFile != null) {
interpreter = new Interpreter(modelFile);
Log.i(TAG, "onSuccess interpreter has been created successful : " + modelFile.toString());
}
}
});
}
public Interpreter getInterpreter() {
return interpreter;
}
}
Unfortunatelly my model loading is failed with error: FirebaseMlException: Model download in bad state - please retry Please explain what I'm doing wrong...