Skip to content

Commit 5e6a957

Browse files
committed
run predictions on background queues
1 parent 5437188 commit 5e6a957

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/coreml/MLModel+Compat.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ - (void) predictionFromFeatures:(id<MLFeatureProvider>) input
1010
[NSOperationQueue.mainQueue addOperationWithBlock:^{
1111
NSError *error = nil;
1212
id<MLFeatureProvider> prediction = [self predictionFromFeatures:input error:&error];
13-
completionHandler(prediction, error);
13+
14+
[NSOperationQueue.mainQueue addOperationWithBlock:^{
15+
completionHandler(prediction, error);
16+
}];
1417
}];
1518
}
1619

@@ -20,7 +23,10 @@ - (void) predictionFromFeatures:(id<MLFeatureProvider>) input
2023
[NSOperationQueue.mainQueue addOperationWithBlock:^{
2124
NSError *error = nil;
2225
id<MLFeatureProvider> prediction = [self predictionFromFeatures:input options:options error:&error];
23-
completionHandler(prediction, error);
26+
27+
[NSOperationQueue.mainQueue addOperationWithBlock:^{
28+
completionHandler(prediction, error);
29+
}];
2430
}];
2531
}
2632

0 commit comments

Comments
 (0)