add ramdisk, load AI model to ramdisk and start recognition from it

rewrite zmq to DEALER and ROUTER
add GET_USER command to get CurrentUser from Python
all auth is on the python side
inference run and validate annotations on python
This commit is contained in:
Alex Bezdieniezhnykh
2025-01-29 17:45:26 +02:00
parent 82b3b526a7
commit 62623b7123
55 changed files with 945 additions and 895 deletions
+7 -15
View File
@@ -1,7 +1,5 @@
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Windows;
using System.Windows.Threading;
using Azaion.Annotator;
@@ -13,7 +11,6 @@ using Azaion.Common.Events;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
using Azaion.CommonSecurity;
using Azaion.CommonSecurity.DTO;
using Azaion.CommonSecurity.Services;
using Azaion.Dataset;
using LibVLCSharp.Shared;
@@ -23,7 +20,6 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Serilog;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
@@ -36,8 +32,7 @@ public partial class App
private IMediator _mediator = null!;
private FormState _formState = null!;
private AzaionApiClient _apiClient = null!;
private IResourceLoader _resourceLoader = null!;
private PythonResourceLoader _resourceLoader = null!;
private Stream _securedConfig = null!;
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
@@ -64,9 +59,8 @@ public partial class App
var login = new Login();
login.CredentialsEntered += async (s, args) =>
{
_apiClient = AzaionApiClient.Create(args);
_resourceLoader = new PythonResourceLoader(args);
_securedConfig = await _resourceLoader.Load("secured-config.json");
_securedConfig = await _resourceLoader.LoadFile("secured-config.json");
AppDomain.CurrentDomain.AssemblyResolve += (_, a) =>
{
@@ -75,7 +69,7 @@ public partial class App
{
try
{
var stream = _resourceLoader.Load($"{assemblyName}.dll").GetAwaiter().GetResult();
var stream = _resourceLoader.LoadFile($"{assemblyName}.dll").GetAwaiter().GetResult();
return Assembly.Load(stream.ToArray());
}
catch (Exception e)
@@ -124,11 +118,11 @@ public partial class App
services.AddSingleton<MainSuite>();
services.AddSingleton<IHardwareService, HardwareService>();
services.AddSingleton(_apiClient);
services.AddSingleton(_resourceLoader);
services.AddSingleton<IResourceLoader>(_resourceLoader);
services.AddSingleton<IAuthProvider>(_resourceLoader);
services.AddSingleton<IInferenceService, PythonInferenceService>();
services.Configure<AppConfig>(context.Configuration);
services.ConfigureSection<ApiConfig>(context.Configuration);
services.ConfigureSection<QueueConfig>(context.Configuration);
services.ConfigureSection<DirectoriesConfig>(context.Configuration);
services.ConfigureSection<AnnotationConfig>(context.Configuration);
@@ -139,7 +133,6 @@ public partial class App
services.AddSingleton<Annotator.Annotator>();
services.AddSingleton<DatasetExplorer>();
services.AddSingleton<HelpWindow>();
services.AddSingleton<IAIDetector, YOLODetector>();
services.AddMediatR(c => c.RegisterServicesFromAssemblies(
typeof(Annotator.Annotator).Assembly,
typeof(DatasetExplorer).Assembly,
@@ -152,10 +145,9 @@ public partial class App
return new MediaPlayer(libVLC);
});
services.AddSingleton<AnnotatorEventHandler>();
services.AddSingleton<VLCFrameExtractor>();
services.AddSingleton<IDbFactory, DbFactory>();
services.AddSingleton<FailsafeAnnotationsProducer>();
services.AddSingleton<FailsafeAnnotationsProducer>();
services.AddSingleton<AnnotationService>();