mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-13 05:48:40 +00:00
Added vae as parameter in the example
This commit is contained in:
parent
237a92d6ba
commit
6d298155b2
@ -35,6 +35,12 @@
|
|||||||
<TextBox Text="{Binding ModelPath}" />
|
<TextBox Text="{Binding ModelPath}" />
|
||||||
</DockPanel>
|
</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>
|
||||||
|
|
||||||
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
|
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
|
||||||
|
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|||||||
@ -20,6 +20,13 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
set => SetProperty(ref _modelPath, value);
|
set => SetProperty(ref _modelPath, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string _vaePath = string.Empty;
|
||||||
|
public string VaePath
|
||||||
|
{
|
||||||
|
get => _vaePath;
|
||||||
|
set => SetProperty(ref _vaePath, value);
|
||||||
|
}
|
||||||
|
|
||||||
private string _prompt = string.Empty;
|
private string _prompt = string.Empty;
|
||||||
public string Prompt
|
public string Prompt
|
||||||
{
|
{
|
||||||
@ -62,7 +69,7 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
set => SetProperty(ref _steps, value);
|
set => SetProperty(ref _steps, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _seed = 0;
|
private int _seed = -1;
|
||||||
public int Seed
|
public int Seed
|
||||||
{
|
{
|
||||||
get => _seed;
|
get => _seed;
|
||||||
@ -106,6 +113,9 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
private ActionCommand? _selectModelCommand;
|
private ActionCommand? _selectModelCommand;
|
||||||
public ActionCommand SelectModelCommand => _selectModelCommand ??= new ActionCommand(SelectModel);
|
public ActionCommand SelectModelCommand => _selectModelCommand ??= new ActionCommand(SelectModel);
|
||||||
|
|
||||||
|
private ActionCommand? _selectVaeCommand;
|
||||||
|
public ActionCommand SelectVaeCommand => _selectVaeCommand ??= new ActionCommand(SelectVae);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@ -136,7 +146,7 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
_model?.Dispose();
|
_model?.Dispose();
|
||||||
|
|
||||||
LogLine($"Loading model '{ModelPath}'");
|
LogLine($"Loading model '{ModelPath}'");
|
||||||
_model = await Task.Run(() => new StableDiffusionModel(ModelPath, new ModelParameter()));
|
_model = await Task.Run(() => new StableDiffusionModel(ModelPath, new ModelParameter { VaePath = VaePath }));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -204,6 +214,13 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
ModelPath = openFileDialog.FileName;
|
ModelPath = openFileDialog.FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SelectVae()
|
||||||
|
{
|
||||||
|
OpenFileDialog openFileDialog = new() { Filter = "Stable Diffusion VAE|*.*" };
|
||||||
|
if (openFileDialog.ShowDialog() == true)
|
||||||
|
VaePath = openFileDialog.FileName;
|
||||||
|
}
|
||||||
|
|
||||||
private void LogLine(string line, bool appendNewLine = true)
|
private void LogLine(string line, bool appendNewLine = true)
|
||||||
{
|
{
|
||||||
if (appendNewLine)
|
if (appendNewLine)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user