Fixed crash on devices without Google Play Services installed (which provides TensorFlowLite)

This commit is contained in:
Graham Jones
2023-02-03 21:57:12 +00:00
parent f4e5db2a44
commit 467fd0cc7f

View File

@@ -63,8 +63,10 @@ public class SdAlgNn {
public void close() {
Log.d(TAG,"close()");
if (interpreter != null) {
interpreter.close();
}
}
public float getPseizure(SdData sdData) {
int i;
@@ -73,6 +75,10 @@ public class SdAlgNn {
for (int j = 0; j < 125; j++) {
modelInput[0][j][0] = (float)sdData.rawData[j];
}
if (interpreter == null) {
Log.d(TAG,"getPSeizure() - interpreter is null - returning zero seizure probability");
return (0.0f);
}
interpreter.run(modelInput, modelOutput);
Log.d(TAG,"run - pSeizure="+modelOutput[0][1]);
return(modelOutput[0][1]);