Skip to content

Commit d8a629c

Browse files
committed
Updated example for 3.0.0
1 parent ae70f7e commit d8a629c

File tree

3 files changed

+213
-89
lines changed

3 files changed

+213
-89
lines changed

Examples/ImageCreationUI/ImageCreationUI.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="HPPH.System.Drawing" Version="1.0.0" />
14-
<PackageReference Include="StableDiffusion.NET" Version="2.0.0" />
15-
<PackageReference Include="StableDiffusion.NET.Backend.Cpu" Version="2.0.0" />
16-
<PackageReference Include="StableDiffusion.NET.Backend.Cuda" Version="2.0.0" />
17-
<PackageReference Include="StableDiffusion.NET.Backend.Rocm" Version="2.0.0" />
14+
<PackageReference Include="StableDiffusion.NET.Backend.Cpu" Version="3.0.0" />
15+
<PackageReference Include="StableDiffusion.NET.Backend.Cuda" Version="3.0.0" />
16+
<PackageReference Include="StableDiffusion.NET.Backend.Rocm" Version="3.0.0" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<ProjectReference Include="..\..\StableDiffusion.NET\StableDiffusion.NET.csproj" />
1821
</ItemGroup>
1922

2023
</Project>

Examples/ImageCreationUI/MainWindow.xaml

Lines changed: 88 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
99
xmlns:sd="clr-namespace:StableDiffusion.NET;assembly=StableDiffusion.NET"
1010
mc:Ignorable="d"
11-
Title="StableDiffusion.NET" Width="1280" Height="800">
11+
Title="StableDiffusion.NET" Width="1706" Height="960">
1212
<Window.DataContext>
1313
<local:MainWindowViewModel />
1414
</Window.DataContext>
@@ -42,81 +42,112 @@
4242
<ColumnDefinition Width="400" />
4343
</Grid.ColumnDefinitions>
4444

45-
<StackPanel Margin="4,0" Orientation="Vertical">
46-
<TextBlock Margin="8" Text="This is just an example - inputs are not validated!&#10;Make sure everything is correct before pressing 'Create Image'." />
45+
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
46+
<StackPanel Margin="4,0" Orientation="Vertical">
47+
<TextBlock Margin="8" Text="This is just an example - inputs are not validated!&#10;Make sure everything is correct before pressing 'Create Image'." />
4748

48-
<Separator />
49+
<Separator />
4950

50-
<Label Content="Model-Path" />
51-
<DockPanel>
52-
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectModelCommand}" IsEnabled="{Binding IsReady}" />
53-
<TextBox Text="{Binding ModelPath}" />
54-
</DockPanel>
51+
<Label Content="Model-Type" />
52+
<StackPanel Orientation="Horizontal" Margin="4,0,0,0">
53+
<RadioButton Content="Stable Diffusion" IsChecked="{Binding IsStableDiffusionSelected}" GroupName="ModelType" />
54+
<RadioButton Margin="16,0,0,0" Content="Flux" IsChecked="{Binding IsFluxSelected}" GroupName="ModelType" />
55+
</StackPanel>
5556

56-
<Label Content="Vae-Path (Optional)" />
57-
<DockPanel>
58-
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectVaeCommand}" IsEnabled="{Binding IsReady}" />
59-
<TextBox Text="{Binding VaePath}" />
60-
</DockPanel>
57+
<StackPanel Orientation="Vertical" IsEnabled="{Binding IsStableDiffusionSelected}">
58+
<Label Content="Model-Path" />
59+
<DockPanel>
60+
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectModelCommand}" IsEnabled="{Binding IsReady}" />
61+
<TextBox Text="{Binding ModelPath}" />
62+
</DockPanel>
63+
</StackPanel>
6164

62-
<Label Content="Schedule" />
63-
<ComboBox ItemsSource="{Binding Source={StaticResource ScheduleDataSource}}" SelectedItem="{Binding Schedule}" />
65+
<StackPanel Orientation="Vertical" IsEnabled="{Binding IsFluxSelected}">
66+
<Label Content="DiffusionModel-Path" />
67+
<DockPanel>
68+
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectDiffusionModelCommand}" IsEnabled="{Binding IsReady}" />
69+
<TextBox Text="{Binding DiffusionModelPath}" />
70+
</DockPanel>
6471

65-
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
72+
<Label Content="ClipL-Path" />
73+
<DockPanel>
74+
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectClipLCommand}" IsEnabled="{Binding IsReady}" />
75+
<TextBox Text="{Binding ClipLPath}" />
76+
</DockPanel>
6677

67-
<Separator />
78+
<Label Content="T5xxl-Path" />
79+
<DockPanel>
80+
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectT5xxlCommand}" IsEnabled="{Binding IsReady}" />
81+
<TextBox Text="{Binding T5xxlPath}" />
82+
</DockPanel>
83+
</StackPanel>
6884

69-
<Label Margin="0,8,0,0" Content="Prompt" />
70-
<TextBox Height="80" TextWrapping="Wrap" Text="{Binding Prompt}" />
85+
<Label Content="Vae-Path (Optional)" />
86+
<DockPanel>
87+
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectVaeCommand}" IsEnabled="{Binding IsReady}" />
88+
<TextBox Text="{Binding VaePath}" />
89+
</DockPanel>
7190

72-
<Label Content="AntiPrompt" />
73-
<TextBox Height="80" TextWrapping="Wrap" Text="{Binding AntiPrompt}" />
91+
<Label Content="Schedule" />
92+
<ComboBox ItemsSource="{Binding Source={StaticResource ScheduleDataSource}}" SelectedItem="{Binding Schedule}" />
7493

75-
<DockPanel LastChildFill="True">
76-
<StackPanel DockPanel.Dock="Left">
77-
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
78-
<Label Width="50" Content="Width" />
79-
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Width}" />
80-
</StackPanel>
94+
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
8195

82-
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
83-
<Label Width="50" Content="Height" />
84-
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Height}" />
85-
</StackPanel>
96+
<Separator />
8697

87-
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
88-
<Label Width="50" Content="Cfg" />
89-
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Cfg}" />
90-
</StackPanel>
98+
<Label Margin="0,8,0,0" Content="Prompt" />
99+
<TextBox Height="80" TextWrapping="Wrap" Text="{Binding Prompt}" />
91100

92-
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
93-
<Label Width="50" Content="Steps" />
94-
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Steps}" />
95-
</StackPanel>
101+
<Label Content="AntiPrompt" />
102+
<TextBox Height="60" TextWrapping="Wrap" Text="{Binding AntiPrompt}" />
103+
104+
<DockPanel LastChildFill="True">
105+
<StackPanel DockPanel.Dock="Left">
106+
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
107+
<Label Width="50" Content="Width" />
108+
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Width}" />
109+
</StackPanel>
110+
111+
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
112+
<Label Width="50" Content="Height" />
113+
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Height}" />
114+
</StackPanel>
115+
116+
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
117+
<Label Width="50" Content="Cfg" />
118+
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Cfg}" />
119+
</StackPanel>
96120

97-
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
98-
<Label Width="50" Content="Seed" />
99-
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Seed}" />
121+
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
122+
<Label Width="50" Content="Steps" />
123+
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Steps}" />
124+
</StackPanel>
125+
126+
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
127+
<Label Width="50" Content="Seed" />
128+
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Seed}" />
129+
</StackPanel>
100130
</StackPanel>
101-
</StackPanel>
102131

103-
<DockPanel Margin="16,0,0,0" LastChildFill="True">
104-
<Label DockPanel.Dock="Top" Content="Image2Image Source" />
105-
<DockPanel DockPanel.Dock="Top" >
106-
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectImage2ImageSourceCommand}" IsEnabled="{Binding IsReady}" />
107-
<TextBox Text="{Binding Image2ImageSourcePath}" />
108-
</DockPanel>
132+
<DockPanel Margin="16,0,0,0" LastChildFill="True">
133+
<Label DockPanel.Dock="Top" Content="Image2Image Source" />
134+
<DockPanel DockPanel.Dock="Top" >
135+
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectImage2ImageSourceCommand}" IsEnabled="{Binding IsReady}" />
136+
<TextBox Text="{Binding Image2ImageSourcePath}" />
137+
</DockPanel>
109138

110-
<Image Source="{Binding Image2ImageSource, Converter={StaticResource ImageToImageSourceConverter}}" />
139+
<Image Source="{Binding Image2ImageSource, Converter={StaticResource ImageToImageSourceConverter}}" />
140+
</DockPanel>
111141
</DockPanel>
112-
</DockPanel>
113142

114-
<Label Content="Sample-Method" />
115-
<ComboBox ItemsSource="{Binding Source={StaticResource SamplerDataSource}}" SelectedItem="{Binding SampleMethod}" />
143+
<Label Content="Sample-Method" />
144+
<ComboBox ItemsSource="{Binding Source={StaticResource SamplerDataSource}}" SelectedItem="{Binding SampleMethod}" />
145+
146+
<Button Margin="0,16,0,0" Content="Create Image" Command="{Binding CreateImageCommand}" IsEnabled="{Binding IsReady}" />
147+
<Button Margin="0,16,0,0" Content="Save Image" Command="{Binding SaveImageCommand}" IsEnabled="{Binding IsReady}" />
148+
</StackPanel>
116149

117-
<Button Margin="0,16,0,0" Content="Create Image" Command="{Binding CreateImageCommand}" IsEnabled="{Binding IsReady}" />
118-
<Button Margin="0,16,0,0" Content="Save Image" Command="{Binding SaveImageCommand}" IsEnabled="{Binding IsReady}" />
119-
</StackPanel>
150+
</ScrollViewer>
120151

121152
<GridSplitter Grid.Column="1" Margin="2,0" Width="2" Background="DimGray" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
122153

0 commit comments

Comments
 (0)