, , . .
, Clarifai , , start() Thread. , Thread .
, :
final Bitmap bitmap = mResultsBitmap;
final File pFile2 = f;
ClarifaiClient client = new ClarifaiBuilder("mykeyhere1234}").buildSync();
DefaultModels defaultModels = client.getDefaultModels();
Log.e("this:"," this is running 0");
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 0 , bos);
byte[] bitmapdata = bos.toByteArray();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(pFile2);
fos.write(bitmapdata);
} catch (FileNotFoundException e | IOException e) {
e.printStackTrace();
} finally {
try {
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Log.e("this:", " this is running 1");
client =
Log.e("this:", " this is running 2");
Log.e("this:", " this is running 3");
Log.e("this", models.generalModel().predict()
.withInputs(
ClarifaiInput.forImage(ClarifaiImage.of(pFile2))
)
.executeSync().rawBody());
Log.e("this:", " this is running 4");
}
});
thread.start();