This repository was archived by the owner on Nov 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
OnnxStack.StableDiffusion Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,18 @@ public static void AddOnnxStack(this IServiceCollection serviceCollection)
2121 }
2222
2323
24+ /// <summary>
25+ /// Register OnnxStack services
26+ /// </summary>
27+ /// <param name="serviceCollection">The service collection.</param>
28+ /// <param name="configuration">The configuration.</param>
29+ public static void AddOnnxStack ( this IServiceCollection serviceCollection , OnnxStackConfig configuration )
30+ {
31+ serviceCollection . AddSingleton ( configuration ) ;
32+ serviceCollection . AddSingleton < IOnnxModelService , OnnxModelService > ( ) ;
33+ }
34+
35+
2436 /// <summary>
2537 /// Register a custom IConfigSection section that is in the appsettings.json
2638 /// </summary>
Original file line number Diff line number Diff line change @@ -21,9 +21,27 @@ public static class Registration
2121 /// <param name="serviceCollection">The service collection.</param>
2222 public static void AddOnnxStackStableDiffusion ( this IServiceCollection serviceCollection )
2323 {
24- ConfigureLibraries ( ) ;
2524 serviceCollection . AddOnnxStack ( ) ;
25+ serviceCollection . RegisterServices ( ) ;
2626 serviceCollection . AddSingleton ( ConfigManager . LoadConfiguration < StableDiffusionConfig > ( nameof ( OnnxStackConfig ) ) ) ;
27+ }
28+
29+
30+ /// <summary>
31+ /// Register OnnxStack StableDiffusion services, AddOnnxStack() must be called before
32+ /// </summary>
33+ /// <param name="serviceCollection">The service collection.</param>
34+ /// <param name="configuration">The configuration.</param>
35+ public static void AddOnnxStackStableDiffusion ( this IServiceCollection serviceCollection , StableDiffusionConfig configuration )
36+ {
37+ serviceCollection . RegisterServices ( ) ;
38+ serviceCollection . AddSingleton ( configuration ) ;
39+ }
40+
41+
42+ private static void RegisterServices ( this IServiceCollection serviceCollection )
43+ {
44+ ConfigureLibraries ( ) ;
2745
2846 // Services
2947 serviceCollection . AddSingleton < IPromptService , PromptService > ( ) ;
You can’t perform that action at this time.
0 commit comments