mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:26:30 +00:00
add gps matcher service
This commit is contained in:
@@ -17,20 +17,20 @@ public interface IInferenceService
|
||||
void StopInference();
|
||||
}
|
||||
|
||||
public class InferenceService(ILogger<InferenceService> logger, [FromKeyedServices(SecurityConstants.EXTERNAL_INFERENCE_PATH)] IExternalClient externalClient, IOptions<AIRecognitionConfig> aiConfigOptions) : IInferenceService
|
||||
public class InferenceService(ILogger<InferenceService> logger, IInferenceClient client, IOptions<AIRecognitionConfig> aiConfigOptions) : IInferenceService
|
||||
{
|
||||
public async Task RunInference(List<string> mediaPaths, Func<AnnotationImage, Task> processAnnotation, CancellationToken detectToken = default)
|
||||
{
|
||||
var aiConfig = aiConfigOptions.Value;
|
||||
|
||||
aiConfig.Paths = mediaPaths;
|
||||
externalClient.Send(RemoteCommand.Create(CommandType.Inference, aiConfig));
|
||||
client.Send(RemoteCommand.Create(CommandType.Inference, aiConfig));
|
||||
|
||||
while (!detectToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
var bytes = externalClient.GetBytes(ct: detectToken);
|
||||
var bytes = client.GetBytes(ct: detectToken);
|
||||
if (bytes == null)
|
||||
throw new Exception("Can't get bytes from inference client");
|
||||
|
||||
@@ -51,6 +51,6 @@ public class InferenceService(ILogger<InferenceService> logger, [FromKeyedServic
|
||||
|
||||
public void StopInference()
|
||||
{
|
||||
externalClient.Send(RemoteCommand.Create(CommandType.StopInference));
|
||||
client.Send(RemoteCommand.Create(CommandType.StopInference));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user