11using Microsoft . ML . OnnxRuntime . Tensors ;
2+ using OnnxStack . Core . Config ;
23using OnnxStack . StableDiffusion . Config ;
34using OnnxStack . StableDiffusion . Models ;
45using SixLabors . ImageSharp ;
@@ -18,15 +19,15 @@ public interface IStableDiffusionService
1819 /// </summary>
1920 /// <param name="modelOptions">The model options.</param>
2021 /// <returns></returns>
21- Task < bool > LoadModelAsync ( StableDiffusionModelSet model ) ;
22+ Task < bool > LoadModelAsync ( IOnnxModelSetConfig model ) ;
2223
2324
2425 /// <summary>
2526 /// Unloads the model.
2627 /// </summary>
2728 /// <param name="modelOptions">The model options.</param>
2829 /// <returns></returns>
29- Task < bool > UnloadModelAsync ( StableDiffusionModelSet model ) ;
30+ Task < bool > UnloadModelAsync ( IOnnxModel model ) ;
3031
3132 /// <summary>
3233 /// Determines whether the specified model is loaded
@@ -35,7 +36,7 @@ public interface IStableDiffusionService
3536 /// <returns>
3637 /// <c>true</c> if the specified model is loaded; otherwise, <c>false</c>.
3738 /// </returns>
38- bool IsModelLoaded ( StableDiffusionModelSet model ) ;
39+ bool IsModelLoaded ( IOnnxModel model ) ;
3940
4041 /// <summary>
4142 /// Generates the StableDiffusion image using the prompt and options provided.
@@ -45,7 +46,7 @@ public interface IStableDiffusionService
4546 /// <param name="progressCallback">The callback used to provide progess of the current InferenceSteps.</param>
4647 /// <param name="cancellationToken">The cancellation token.</param>
4748 /// <returns>The diffusion result as <see cref="DenseTensor<float>"/></returns>
48- Task < DenseTensor < float > > GenerateAsync ( StableDiffusionModelSet model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
49+ Task < DenseTensor < float > > GenerateAsync ( ModelOptions model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
4950
5051 /// <summary>
5152 /// Generates the StableDiffusion image using the prompt and options provided.
@@ -55,7 +56,7 @@ public interface IStableDiffusionService
5556 /// <param name="progressCallback">The callback used to provide progess of the current InferenceSteps.</param>
5657 /// <param name="cancellationToken">The cancellation token.</param>
5758 /// <returns>The diffusion result as <see cref="SixLabors.ImageSharp.Image<Rgba32>"/></returns>
58- Task < Image < Rgba32 > > GenerateAsImageAsync ( StableDiffusionModelSet model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
59+ Task < Image < Rgba32 > > GenerateAsImageAsync ( ModelOptions model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
5960
6061 /// <summary>
6162 /// Generates the StableDiffusion image using the prompt and options provided.
@@ -65,7 +66,7 @@ public interface IStableDiffusionService
6566 /// <param name="progressCallback">The callback used to provide progess of the current InferenceSteps.</param>
6667 /// <param name="cancellationToken">The cancellation token.</param>
6768 /// <returns>The diffusion result as <see cref="byte[]"/></returns>
68- Task < byte [ ] > GenerateAsBytesAsync ( StableDiffusionModelSet model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
69+ Task < byte [ ] > GenerateAsBytesAsync ( ModelOptions model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
6970
7071 /// <summary>
7172 /// Generates the StableDiffusion image using the prompt and options provided.
@@ -75,7 +76,7 @@ public interface IStableDiffusionService
7576 /// <param name="progressCallback">The callback used to provide progess of the current InferenceSteps.</param>
7677 /// <param name="cancellationToken">The cancellation token.</param>
7778 /// <returns>The diffusion result as <see cref="System.IO.Stream"/></returns>
78- Task < Stream > GenerateAsStreamAsync ( StableDiffusionModelSet model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
79+ Task < Stream > GenerateAsStreamAsync ( ModelOptions model , PromptOptions prompt , SchedulerOptions options , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
7980
8081 /// <summary>
8182 /// Generates a batch of StableDiffusion image using the prompt and options provided.
@@ -87,7 +88,7 @@ public interface IStableDiffusionService
8788 /// <param name="progressCallback">The progress callback.</param>
8889 /// <param name="cancellationToken">The cancellation token.</param>
8990 /// <returns></returns>
90- IAsyncEnumerable < BatchResult > GenerateBatchAsync ( StableDiffusionModelSet model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
91+ IAsyncEnumerable < BatchResult > GenerateBatchAsync ( ModelOptions model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
9192
9293 /// <summary>
9394 /// Generates a batch of StableDiffusion image using the prompt and options provided.
@@ -99,7 +100,7 @@ public interface IStableDiffusionService
99100 /// <param name="progressCallback">The progress callback.</param>
100101 /// <param name="cancellationToken">The cancellation token.</param>
101102 /// <returns></returns>
102- IAsyncEnumerable < Image < Rgba32 > > GenerateBatchAsImageAsync ( StableDiffusionModelSet model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
103+ IAsyncEnumerable < Image < Rgba32 > > GenerateBatchAsImageAsync ( ModelOptions model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
103104
104105 /// <summary>
105106 /// Generates a batch of StableDiffusion image using the prompt and options provided.
@@ -111,7 +112,7 @@ public interface IStableDiffusionService
111112 /// <param name="progressCallback">The progress callback.</param>
112113 /// <param name="cancellationToken">The cancellation token.</param>
113114 /// <returns></returns>
114- IAsyncEnumerable < byte [ ] > GenerateBatchAsBytesAsync ( StableDiffusionModelSet model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
115+ IAsyncEnumerable < byte [ ] > GenerateBatchAsBytesAsync ( ModelOptions model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
115116
116117 /// <summary>
117118 /// Generates a batch of StableDiffusion image using the prompt and options provided.
@@ -123,6 +124,6 @@ public interface IStableDiffusionService
123124 /// <param name="progressCallback">The progress callback.</param>
124125 /// <param name="cancellationToken">The cancellation token.</param>
125126 /// <returns></returns>
126- IAsyncEnumerable < Stream > GenerateBatchAsStreamAsync ( StableDiffusionModelSet model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
127+ IAsyncEnumerable < Stream > GenerateBatchAsStreamAsync ( ModelOptions model , PromptOptions promptOptions , SchedulerOptions schedulerOptions , BatchOptions batchOptions , Action < DiffusionProgress > progressCallback = null , CancellationToken cancellationToken = default ) ;
127128 }
128129}
0 commit comments