mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-13 05:48:40 +00:00
130 lines
6.5 KiB
XML
130 lines
6.5 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="1280" Height="800">
|
|
<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>
|
|
|
|
<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-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>
|
|
|
|
<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}" />
|
|
|
|
<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="80" 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>
|
|
|
|
<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>
|