Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit b88ab19

Browse files
committed
Fix broken examples
1 parent db4ac87 commit b88ab19

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

OnnxStack.Console/Examples/StableDebug.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ public async Task RunAsync()
2929
{
3030
Directory.CreateDirectory(_outputDirectory);
3131

32+
var model = _stableDiffusionService.Models.First();
33+
await _stableDiffusionService.LoadModel(model);
34+
3235
var prompt = "High-fashion photography in an abandoned industrial warehouse, with dramatic lighting and edgy outfits, detailed clothing, intricate clothing, seductive pose, action pose, motion, beautiful digital artwork, atmospheric, warm sunlight, photography, neo noir, bokeh, beautiful dramatic lighting, shallow depth of field, photorealism, volumetric lighting, Ultra HD, raytracing, studio quality, octane render";
3336
var negativePrompt = "painting, drawing, sketches, monochrome, grayscale, illustration, anime, cartoon, graphic, text, crayon, graphite, abstract, easynegative, low quality, normal quality, worst quality, lowres, close up, cropped, out of frame, jpeg artifacts, duplicate, morbid, mutilated, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, glitch, deformed, mutated, cross-eyed, ugly, dehydrated, bad anatomy, bad proportions, gross proportions, cloned face, disfigured, malformed limbs, missing arms, missing legs fused fingers, too many fingers,extra fingers, extra limbs,, extra arms, extra legs,disfigured,";
3437
while (true)
3538
{
36-
var model = _stableDiffusionService.Models.First();
37-
3839
var promptOptions = new PromptOptions
3940
{
4041
Prompt = prompt,

OnnxStack.Console/Examples/StableDiffusionExample.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ public async Task RunAsync()
2828
{
2929
Directory.CreateDirectory(_outputDirectory);
3030

31+
var model = _stableDiffusionService.Models.First();
32+
await _stableDiffusionService.LoadModel(model);
33+
3134
while (true)
3235
{
33-
var model = _stableDiffusionService.Models.First();
34-
3536
OutputHelpers.WriteConsole("Please type a prompt and press ENTER", ConsoleColor.Yellow);
3637
var prompt = OutputHelpers.ReadConsole(ConsoleColor.Cyan);
3738

@@ -42,7 +43,7 @@ public async Task RunAsync()
4243
{
4344
Prompt = prompt,
4445
NegativePrompt = negativePrompt,
45-
46+
4647
};
4748

4849
var schedulerOptions = new SchedulerOptions

OnnxStack.Console/Examples/StableDiffusionGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public async Task RunAsync()
3232
Directory.CreateDirectory(_outputDirectory);
3333

3434
var model = _stableDiffusionService.Models.First();
35+
await _stableDiffusionService.LoadModel(model);
3536

3637
var seed = Random.Shared.Next();
3738
foreach (var generationPrompt in _generationPrompts)

OnnxStack.WebUI/Hubs/StableDiffusionHub.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ private async Task<StableDiffusionResult> GenerateTextToImageResult(PromptOption
145145

146146
//TODO: Model Selector
147147
var model = _stableDiffusionService.Models.First();
148+
await _stableDiffusionService.LoadModel(model);
148149

149150
//3. Run stable diffusion
150151
if (!await RunStableDiffusion(model, promptOptions, schedulerOptions, outputImageFile, cancellationToken))
@@ -191,6 +192,7 @@ private async Task<StableDiffusionResult> GenerateImageToImageResult(PromptOptio
191192

192193
//TODO: Model Selector
193194
var model = _stableDiffusionService.Models.First();
195+
await _stableDiffusionService.LoadModel(model);
194196

195197
//4. Run stable diffusion
196198
if (!await RunStableDiffusion(model, promptOptions, schedulerOptions, outputImageFile, cancellationToken))
@@ -244,6 +246,7 @@ private async Task<StableDiffusionResult> GenerateImageInpaintResult(PromptOptio
244246

245247
//TODO: Model Selector
246248
var model = _stableDiffusionService.Models.First();
249+
await _stableDiffusionService.LoadModel(model);
247250

248251
// 5. Run stable diffusion
249252
if (!await RunStableDiffusion(model, promptOptions, schedulerOptions, outputImageFile, cancellationToken))

0 commit comments

Comments
 (0)