add gps matcher service

This commit is contained in:
Alex Bezdieniezhnykh
2025-04-14 09:50:34 +03:00
parent 36b3bf1712
commit ca1682a86e
26 changed files with 759 additions and 119 deletions
+4 -4
View File
@@ -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));
}
}