mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-12 13:28:35 +00:00
166 lines
8.8 KiB
XML
166 lines
8.8 KiB
XML
<Window x:Class="ImageCreationUI.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:local="clr-namespace:ImageCreationUI"
|
|
xmlns:converter="clr-namespace:ImageCreationUI.Converter"
|
|
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
|
xmlns:sd="clr-namespace:StableDiffusion.NET;assembly=StableDiffusion.NET"
|
|
mc:Ignorable="d"
|
|
Title="StableDiffusion.NET" Width="1706" Height="960">
|
|
<Window.DataContext>
|
|
<local:MainWindowViewModel />
|
|
</Window.DataContext>
|
|
|
|
<Window.Resources>
|
|
<converter:ImageToImageSourceConverter x:Key="ImageToImageSourceConverter" />
|
|
|
|
<ObjectDataProvider x:Key="ScheduleDataSource"
|
|
ObjectType="{x:Type sys:Enum}"
|
|
MethodName="GetValues">
|
|
<ObjectDataProvider.MethodParameters>
|
|
<x:Type TypeName="sd:Schedule" />
|
|
</ObjectDataProvider.MethodParameters>
|
|
</ObjectDataProvider>
|
|
|
|
<ObjectDataProvider x:Key="SamplerDataSource"
|
|
ObjectType="{x:Type sys:Enum}"
|
|
MethodName="GetValues">
|
|
<ObjectDataProvider.MethodParameters>
|
|
<x:Type TypeName="sd:Sampler" />
|
|
</ObjectDataProvider.MethodParameters>
|
|
</ObjectDataProvider>
|
|
</Window.Resources>
|
|
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="400" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="400" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
|
<StackPanel Margin="4,0" Orientation="Vertical">
|
|
<TextBlock Margin="8" Text="This is just an example - inputs are not validated! Make sure everything is correct before pressing 'Create Image'." />
|
|
|
|
<Separator />
|
|
|
|
<Label Content="Model-Type" />
|
|
<StackPanel Orientation="Horizontal" Margin="4,0,0,0">
|
|
<RadioButton Content="Stable Diffusion" IsChecked="{Binding IsStableDiffusionSelected}" GroupName="ModelType" />
|
|
<RadioButton Margin="16,0,0,0" Content="Flux" IsChecked="{Binding IsFluxSelected}" GroupName="ModelType" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Orientation="Vertical" IsEnabled="{Binding IsStableDiffusionSelected}">
|
|
<Label Content="Model-Path" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectModelCommand}" IsEnabled="{Binding IsReady}" />
|
|
<TextBox Text="{Binding ModelPath}" />
|
|
</DockPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel Orientation="Vertical" IsEnabled="{Binding IsFluxSelected}">
|
|
<Label Content="DiffusionModel-Path" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectDiffusionModelCommand}" IsEnabled="{Binding IsReady}" />
|
|
<TextBox Text="{Binding DiffusionModelPath}" />
|
|
</DockPanel>
|
|
|
|
<Label Content="ClipL-Path" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectClipLCommand}" IsEnabled="{Binding IsReady}" />
|
|
<TextBox Text="{Binding ClipLPath}" />
|
|
</DockPanel>
|
|
|
|
<Label Content="T5xxl-Path" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectT5xxlCommand}" IsEnabled="{Binding IsReady}" />
|
|
<TextBox Text="{Binding T5xxlPath}" />
|
|
</DockPanel>
|
|
</StackPanel>
|
|
|
|
<Label Content="Vae-Path (Optional)" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectVaeCommand}" IsEnabled="{Binding IsReady}" />
|
|
<TextBox Text="{Binding VaePath}" />
|
|
</DockPanel>
|
|
|
|
<Label Content="Schedule" />
|
|
<ComboBox ItemsSource="{Binding Source={StaticResource ScheduleDataSource}}" SelectedItem="{Binding Schedule}" />
|
|
|
|
<StackPanel Orientation="Horizontal" Margin="0,4,0,0">
|
|
<Label Content="Flash Attention" />
|
|
<CheckBox VerticalAlignment="Center" IsChecked="{Binding FlashAttention}" />
|
|
</StackPanel>
|
|
|
|
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
|
|
|
|
<Separator />
|
|
|
|
<Label Margin="0,8,0,0" Content="Prompt" />
|
|
<TextBox Height="80" TextWrapping="Wrap" Text="{Binding Prompt}" />
|
|
|
|
<Label Content="AntiPrompt" />
|
|
<TextBox Height="60" TextWrapping="Wrap" Text="{Binding AntiPrompt}" />
|
|
|
|
<DockPanel LastChildFill="True">
|
|
<StackPanel DockPanel.Dock="Left">
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
|
|
<Label Width="50" Content="Width" />
|
|
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Width}" />
|
|
</StackPanel>
|
|
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
|
|
<Label Width="50" Content="Height" />
|
|
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Height}" />
|
|
</StackPanel>
|
|
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
|
|
<Label Width="50" Content="Cfg" />
|
|
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Cfg}" />
|
|
</StackPanel>
|
|
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
|
|
<Label Width="50" Content="Steps" />
|
|
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Steps}" />
|
|
</StackPanel>
|
|
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,8,0,0">
|
|
<Label Width="50" Content="Seed" />
|
|
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Seed}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<DockPanel Margin="16,0,0,0" LastChildFill="True">
|
|
<Label DockPanel.Dock="Top" Content="Image2Image Source" />
|
|
<DockPanel DockPanel.Dock="Top" >
|
|
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectImage2ImageSourceCommand}" IsEnabled="{Binding IsReady}" />
|
|
<TextBox Text="{Binding Image2ImageSourcePath}" />
|
|
</DockPanel>
|
|
|
|
<Image Source="{Binding Image2ImageSource, Converter={StaticResource ImageToImageSourceConverter}}" />
|
|
</DockPanel>
|
|
</DockPanel>
|
|
|
|
<Label Content="Sample-Method" />
|
|
<ComboBox ItemsSource="{Binding Source={StaticResource SamplerDataSource}}" SelectedItem="{Binding SampleMethod}" />
|
|
|
|
<Button Margin="0,16,0,0" Content="Create Image" Command="{Binding CreateImageCommand}" IsEnabled="{Binding IsReady}" />
|
|
<Button Margin="0,16,0,0" Content="Save Image" Command="{Binding SaveImageCommand}" IsEnabled="{Binding IsReady}" />
|
|
</StackPanel>
|
|
|
|
</ScrollViewer>
|
|
|
|
<GridSplitter Grid.Column="1" Margin="2,0" Width="2" Background="DimGray" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
|
|
|
|
<Image Grid.Column="2" Source="{Binding Image, Converter={StaticResource ImageToImageSourceConverter}}" />
|
|
|
|
<GridSplitter Grid.Column="3" Margin="2,0" Width="2" Background="DimGray" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
|
|
|
|
<TextBox Grid.Column="4" IsReadOnly="True" BorderThickness="0" AcceptsReturn="True" Text="{Binding Log}" TextChanged="TextBoxBase_OnTextChanged" />
|
|
</Grid>
|
|
</Window>
|