pd home uncommented and updated Diseases class

parent 6ba3ebb8
...@@ -25,7 +25,8 @@ import java.nio.ByteOrder; ...@@ -25,7 +25,8 @@ import java.nio.ByteOrder;
import org.tensorflow.lite.DataType; import org.tensorflow.lite.DataType;
import org.tensorflow.lite.support.tensorbuffer.TensorBuffer; import org.tensorflow.lite.support.tensorbuffer.TensorBuffer;
import com.example.eketha.ml.Model;
import com.example.eketha.ml.Dmodel;
public class Diseases extends AppCompatActivity { public class Diseases extends AppCompatActivity {
...@@ -93,7 +94,8 @@ public class Diseases extends AppCompatActivity { ...@@ -93,7 +94,8 @@ public class Diseases extends AppCompatActivity {
inputFeature0.loadBuffer(byteBuffer); inputFeature0.loadBuffer(byteBuffer);
// Runs model inference and gets result. // Runs model inference and gets result.
Model.Outputs outputs = model.process(inputFeature0); Dmodel dModel = Dmodel.newInstance(getApplicationContext());
Dmodel.Outputs outputs = dModel.process(inputFeature0);
TensorBuffer outputFeature0 = outputs.getOutputFeature0AsTensorBuffer(); TensorBuffer outputFeature0 = outputs.getOutputFeature0AsTensorBuffer();
float[] confidences = outputFeature0.getFloatArray(); float[] confidences = outputFeature0.getFloatArray();
...@@ -124,7 +126,7 @@ public class Diseases extends AppCompatActivity { ...@@ -124,7 +126,7 @@ public class Diseases extends AppCompatActivity {
// Releases model resources if no longer used. // Releases model resources if no longer used.
model.close(); dModel.close();
} catch (IOException e) { } catch (IOException e) {
// TODO Handle the exception // TODO Handle the exception
} }
......
...@@ -19,20 +19,20 @@ public class pdHome extends AppCompatActivity { ...@@ -19,20 +19,20 @@ public class pdHome extends AppCompatActivity {
layer1 = findViewById(R.id.layerPestsDP); layer1 = findViewById(R.id.layerPestsDP);
layer2 = findViewById(R.id.layerDiseasesPD); layer2 = findViewById(R.id.layerDiseasesPD);
// layer1.setOnClickListener(new View.OnClickListener() { layer1.setOnClickListener(new View.OnClickListener() {
// @Override @Override
// public void onClick(View view) { public void onClick(View view) {
// Intent intent = new Intent(getApplicationContext(), Diseases.class); Intent intent = new Intent(getApplicationContext(), Diseases.class);
// startActivity(intent); startActivity(intent);
// } }
// }); });
// layer2.setOnClickListener(new View.OnClickListener() { layer2.setOnClickListener(new View.OnClickListener() {
// @Override @Override
// public void onClick(View view) { public void onClick(View view) {
// Intent intent = new Intent(getApplicationContext(), Pests.class); Intent intent = new Intent(getApplicationContext(), Pests.class);
// startActivity(intent); startActivity(intent);
// } }
// }); });
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment