mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 14:06:31 +00:00
big refactoring. get rid of static properties and coupled architecture. prepare system for integration tests
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Azaion.Common.Services.Inference;
|
||||
|
||||
public interface IInferenceService
|
||||
{
|
||||
Task StartAsync();
|
||||
Task RunInference(List<string> mediaPaths, CameraConfig cameraConfig, CancellationToken ct = default);
|
||||
CancellationTokenSource InferenceCancelTokenSource { get; set; }
|
||||
CancellationTokenSource CheckAIAvailabilityTokenSource { get; set; }
|
||||
@@ -28,12 +29,17 @@ public class InferenceService : IInferenceService
|
||||
_client = client;
|
||||
_azaionApi = azaionApi;
|
||||
_aiConfigOptions = aiConfigOptions;
|
||||
_ = Task.Run(async () => await CheckAIAvailabilityStatus());
|
||||
}
|
||||
|
||||
public CancellationTokenSource InferenceCancelTokenSource { get; set; } = new();
|
||||
public CancellationTokenSource CheckAIAvailabilityTokenSource { get; set; } = new();
|
||||
|
||||
public async Task StartAsync()
|
||||
{
|
||||
_ = Task.Run(async () => await CheckAIAvailabilityStatus());
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task CheckAIAvailabilityStatus()
|
||||
{
|
||||
CheckAIAvailabilityTokenSource = new CancellationTokenSource();
|
||||
|
||||
Reference in New Issue
Block a user