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

Commit 7771715

Browse files
committed
Update code Example README
1 parent 87341f0 commit 7771715

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

OnnxStack.StableDiffusion/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,33 @@ internal class AppService : IHostedService
7373
System.Console.WriteLine("Please type a negative prompt and press ENTER (optional)");
7474
var negativePrompt = System.Console.ReadLine();
7575

76-
var options = new StableDiffusionOptions
76+
System.Console.WriteLine("Please enter image filepath for Img2Img and press ENTER (optional)");
77+
var inputImageFile = System.Console.ReadLine();
78+
79+
var promptOptions = new PromptOptions
7780
{
7881
Prompt = prompt,
7982
NegativePrompt = negativePrompt,
83+
SchedulerType = SchedulerType.LMSScheduler,
84+
InputImage = inputImageFile
85+
};
86+
87+
var schedulerOptions = new SchedulerOptions
88+
{
8089
Seed = Random.Shared.Next(),
81-
SchedulerType = SchedulerType.LMSScheduler
90+
GuidanceScale = 7.5f,
91+
InferenceSteps = 30,
92+
Height = 512,
93+
Width = 512,
94+
Strength = 0.6f // Img2Img
8295
};
8396

8497
System.Console.WriteLine("Generating Image...");
85-
var outputFilename = Path.Combine(_outputDirectory, $"{options.Seed}_{options.SchedulerType}.png");
86-
var result = await _stableDiffusionService.TextToImageFile(options, outputFilename);
98+
var outputFilename = Path.Combine(_outputDirectory, $"{schedulerOptions.Seed}_{promptOptions.SchedulerType}.png");
99+
var result = await _stableDiffusionService.TextToImageFile(promptOptions, schedulerOptions, outputFilename);
87100
if (result is not null)
88101
{
89-
System.Console.WriteLine($"Image Created, FilePath: {outputFilename}");
102+
System.Console.WriteLine($"Image Created, FilePath: {outputFilename}");
90103
}
91104
}
92105
}

0 commit comments

Comments
 (0)