From 51deca52c5487ed3801dbe37f7a8ad99bd306b1d Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sun, 25 Aug 2024 16:58:29 +0200 Subject: [PATCH] Update README.md --- README.md | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5371080..48c484d 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,43 @@ If GPU-support is available it will prefer this over CPU. If you want to add your own native-libraries or need more control over which backend to load, check the static `Backends` class. ### Example +#### 1. Create a model + +stable diffusion: ```csharp -using StableDiffusionModel sd = new(@"", new ModelParameter()); -IImage image = sd.TextToImage("", new StableDiffusionParameter()); +using DiffusionModel model = ModelBuilder.StableDiffusion(@"") + .WithMultithreading() + .Build(); ``` +flux: +```csharp +using DiffusionModel model = ModelBuilder.Flux(@"", + @"", + @"", + @"") + .WithMultithreading() + .Build(); +``` + +#### 2. create image + +with default parameters: +```csharp +IImage image = model.TextToImage(""); +``` + +with custom parameters: +```csharp +IImage image = model.TextToImage("", model.GetDefaultParameter().WithSeed(1234).WithSize(1344, 768)); +``` + +#### 3. (optional) save the image (requires System.Dawing or SkiaSharp extension) +```csharp +File.WriteAllBytes("output.png", image.ToPng()); +``` To process the resulting image further you can write your own extensions or install one of the [HPPH](https://github.com/DarthAffe/HPPH)-extension sets: [HPPH.System.Drawing](https://www.nuget.org/packages/HPPH.System.Drawing) -[HPPH.SkiaSharp](https://www.nuget.org/packages/HPPH.SkiaSharp) \ No newline at end of file +[HPPH.SkiaSharp](https://www.nuget.org/packages/HPPH.SkiaSharp)