mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 13:06:31 +00:00
fix inference UI and annotation saving
This commit is contained in:
@@ -106,6 +106,8 @@ public class AnnotationService : INotificationHandler<AnnotationsDeletedEvent>
|
||||
{
|
||||
a.Time = TimeSpan.FromMilliseconds(a.Milliseconds);
|
||||
a.Name = a.OriginalMediaName.ToTimeName(a.Time);
|
||||
foreach (var det in a.Detections)
|
||||
det.AnnotationName = a.Name;
|
||||
return await SaveAnnotationInner(DateTime.Now, a.OriginalMediaName, a.Time, ".jpg", a.Detections.ToList(),
|
||||
a.Source, new MemoryStream(a.Image), a.CreatedRole, a.CreatedEmail, generateThumbnail: true, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace Azaion.Common.Services;
|
||||
|
||||
public interface IInferenceService
|
||||
{
|
||||
Task RunInference(string mediaPath, Func<AnnotationImage, CancellationToken, Task> processAnnotation, CancellationToken ct = default);
|
||||
Task RunInference(string mediaPath, Func<AnnotationImage, Task> processAnnotation);
|
||||
}
|
||||
|
||||
public class PythonInferenceService(ILogger<PythonInferenceService> logger, IOptions<AIRecognitionConfig> aiConfigOptions) : IInferenceService
|
||||
{
|
||||
public async Task RunInference(string mediaPath, Func<AnnotationImage, CancellationToken, Task> processAnnotation, CancellationToken ct = default)
|
||||
public async Task RunInference(string mediaPath, Func<AnnotationImage, Task> processAnnotation)
|
||||
{
|
||||
using var dealer = new DealerSocket();
|
||||
var clientId = Guid.NewGuid();
|
||||
@@ -42,7 +42,7 @@ public class PythonInferenceService(ILogger<PythonInferenceService> logger, IOpt
|
||||
continue;
|
||||
}
|
||||
|
||||
await processAnnotation(annotationStream, ct);
|
||||
await processAnnotation(annotationStream);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user