Fixed crash on devices without Google Play Services installed (which provides TensorFlowLite)
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user