mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-12 21:38:45 +00:00
Renamed Image to StableDiffusionImage
This commit is contained in:
parent
bd4f90838d
commit
cd62691709
@ -12,5 +12,5 @@ Run `build.bat` to build the native libs (modify params like CUDA-builds if need
|
||||
```csharp
|
||||
using StableDiffusionModel sd = new(@"<path_to_model>", new ModelParameter());
|
||||
using StableDiffusionParameter parameter = new StableDiffusionParameter();
|
||||
using Image image = sd.TextToImage("<prompt>", parameter);
|
||||
using StableDiffusionImage image = sd.TextToImage("<prompt>", parameter);
|
||||
```
|
||||
|
||||
@ -41,22 +41,22 @@ public sealed unsafe class StableDiffusionModel : IDisposable
|
||||
if (!success) throw new IOException("Failed to load model");
|
||||
}
|
||||
|
||||
public Image TextToImage(string prompt, StableDiffusionParameter parameter)
|
||||
public StableDiffusionImage TextToImage(string prompt, StableDiffusionParameter parameter)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
|
||||
byte* result = Native.stable_diffusion_predict_image(_ctx, parameter.ParamPtr, prompt);
|
||||
return new Image(result, parameter.Width, parameter.Height);
|
||||
return new StableDiffusionImage(result, parameter.Width, parameter.Height);
|
||||
}
|
||||
|
||||
public Image ImageToImage(string prompt, Span<byte> image, StableDiffusionParameter parameter)
|
||||
public StableDiffusionImage ImageToImage(string prompt, Span<byte> image, StableDiffusionParameter parameter)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
|
||||
fixed (byte* imagePtr = image)
|
||||
{
|
||||
byte* result = Native.stable_diffusion_image_predict_image(_ctx, parameter.ParamPtr, imagePtr, prompt);
|
||||
return new Image(result, parameter.Width, parameter.Height);
|
||||
return new StableDiffusionImage(result, parameter.Width, parameter.Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace StableDiffusion.NET;
|
||||
|
||||
public sealed unsafe class Image : IDisposable
|
||||
public sealed unsafe class StableDiffusionImage : IDisposable
|
||||
{
|
||||
#region Constants
|
||||
|
||||
@ -33,14 +33,14 @@ public sealed unsafe class Image : IDisposable
|
||||
|
||||
#region Constructors
|
||||
|
||||
internal Image(byte* ptr, int width, int height)
|
||||
internal StableDiffusionImage(byte* ptr, int width, int height)
|
||||
{
|
||||
this._imagePtr = ptr;
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
}
|
||||
|
||||
~Image() => Dispose();
|
||||
~StableDiffusionImage() => Dispose();
|
||||
|
||||
#endregion
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user