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

Commit 16bc942

Browse files
committed
Remove PaintToImage pipeline, Use ImageToImage process
1 parent 82add59 commit 16bc942

23 files changed

+142
-330
lines changed

OnnxStack.StableDiffusion/Diffusers/LatentConsistency/PaintDiffuser.cs

Lines changed: 0 additions & 85 deletions
This file was deleted.

OnnxStack.StableDiffusion/Diffusers/StableDiffusion/PaintDiffuser.cs

Lines changed: 0 additions & 88 deletions
This file was deleted.

OnnxStack.StableDiffusion/Enums/BatchOptionType.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ public enum BatchOptionType
66
Step = 1,
77
Guidance = 2,
88
Strength = 3,
9-
Scheduler = 4,
10-
Realtime = 5
9+
Scheduler = 4
1110
}
1211
}

OnnxStack.StableDiffusion/Enums/DiffuserType.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ public enum DiffuserType
66
ImageToImage = 1,
77
ImageInpaint = 2,
88
ImageInpaintLegacy = 3,
9-
ImageToAnimation = 4,
10-
PaintToImage = 5
9+
ImageToAnimation = 4
1110
}
1211
}

OnnxStack.StableDiffusion/Registration.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ public static void AddOnnxStackStableDiffusion(this IServiceCollection serviceCo
3838
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.StableDiffusion.ImageDiffuser>();
3939
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.StableDiffusion.InpaintDiffuser>();
4040
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.StableDiffusion.InpaintLegacyDiffuser>();
41-
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.StableDiffusion.PaintDiffuser>();
4241

4342
//LatentConsistency
4443
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.LatentConsistency.TextDiffuser>();
4544
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.LatentConsistency.ImageDiffuser>();
4645
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.LatentConsistency.InpaintLegacyDiffuser>();
47-
serviceCollection.AddSingleton<IDiffuser, StableDiffusion.Diffusers.LatentConsistency.PaintDiffuser>();
4846
}
4947

5048

OnnxStack.UI/App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}}, Path=NavigateImageInpaintCommand}" CommandParameter="{Binding}" >
251251
<userControls:FontAwesome Icon="&#xf1fc;" IconStyle="Light" Size="13" ToolTip="Send To Image Inpaint"/>
252252
</Button>
253-
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}}, Path=NavigateImageUpscaleCommand}" CommandParameter="{Binding}" Padding="2,2" BorderThickness="0,1,1,1">
253+
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}}, Path=NavigateImagePaintToImageCommand}" CommandParameter="{Binding}" Padding="2,2" BorderThickness="0,1,1,1">
254254
<userControls:FontAwesome Icon="&#xf065;" IconStyle="Light" Size="13" ToolTip="Send To Upscaler"/>
255255
</Button>
256256
</UniformGrid>

OnnxStack.UI/MainWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<TabItem.Header>
6060
<StackPanel Orientation="Horizontal" Margin="5">
6161
<StackPanel Orientation="Horizontal">
62-
<userControls:FontAwesome Icon="&#xf1fc;" IconStyle="Light"/>
62+
<userControls:FontAwesome Icon="&#xf15b;" IconStyle="Light"/>
6363
<userControls:FontAwesome Icon="&#xf054;" IconStyle="Regular" Size="8" Margin="3"/>
6464
<userControls:FontAwesome Icon="&#xf1c5;" IconStyle="Light"/>
6565
</StackPanel>
@@ -78,7 +78,7 @@
7878
<userControls:FontAwesome Icon="&#xf054;" IconStyle="Regular" Size="8" Margin="3"/>
7979
<userControls:FontAwesome Icon="&#xf1c5;" IconStyle="Light"/>
8080
</StackPanel>
81-
<TextBlock Text="Live Paint" Margin="5,0,0,0"/>
81+
<TextBlock Text="Paint To Image" Margin="5,0,0,0"/>
8282
</StackPanel>
8383
</TabItem.Header>
8484
<views:PaintToImageView UISettings="{Binding UISettings}" Margin="0,6,0,0"/>

OnnxStack.UI/MainWindow.xaml.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public MainWindow(StableDiffusionConfig configuration, OnnxStackUIConfig uiSetti
3737
NavigateTextToImageCommand = new AsyncRelayCommand<ImageResult>(NavigateTextToImage);
3838
NavigateImageToImageCommand = new AsyncRelayCommand<ImageResult>(NavigateImageToImage);
3939
NavigateImageInpaintCommand = new AsyncRelayCommand<ImageResult>(NavigateImageInpaint);
40-
NavigateImageUpscaleCommand = new AsyncRelayCommand<ImageResult>(NavigateImageUpscale);
40+
NavigateImagePaintToImageCommand = new AsyncRelayCommand<ImageResult>(NavigateImagePaintToImage);
4141

4242
WindowCloseCommand = new AsyncRelayCommand(WindowClose);
4343
WindowRestoreCommand = new AsyncRelayCommand(WindowRestore);
@@ -56,7 +56,7 @@ public MainWindow(StableDiffusionConfig configuration, OnnxStackUIConfig uiSetti
5656
public AsyncRelayCommand<ImageResult> NavigateTextToImageCommand { get; }
5757
public AsyncRelayCommand<ImageResult> NavigateImageToImageCommand { get; }
5858
public AsyncRelayCommand<ImageResult> NavigateImageInpaintCommand { get; }
59-
public AsyncRelayCommand<ImageResult> NavigateImageUpscaleCommand { get; }
59+
public AsyncRelayCommand<ImageResult> NavigateImagePaintToImageCommand { get; }
6060

6161
public OnnxStackUIConfig UISettings
6262
{
@@ -86,31 +86,39 @@ public INavigatable SelectedTabItem
8686

8787
private async Task NavigateTextToImage(ImageResult result)
8888
{
89-
await NavigateToTab(DiffuserType.TextToImage, result);
89+
await NavigateToTab(TabId.TextToImage, result);
9090
}
9191

9292
private async Task NavigateImageToImage(ImageResult result)
9393
{
94-
await NavigateToTab(DiffuserType.ImageToImage, result);
94+
await NavigateToTab(TabId.ImageToImage, result);
9595
}
9696

9797
private async Task NavigateImageInpaint(ImageResult result)
9898
{
99-
await NavigateToTab(DiffuserType.ImageInpaint, result);
99+
await NavigateToTab(TabId.ImageInpaint, result);
100100
}
101101

102-
private Task NavigateImageUpscale(ImageResult result)
102+
private async Task NavigateImagePaintToImage(ImageResult result)
103103
{
104-
return Task.CompletedTask;
104+
await NavigateToTab(TabId.PaintToImage, result);
105105
}
106106

107107

108-
private async Task NavigateToTab(DiffuserType diffuserType, ImageResult imageResult)
108+
private async Task NavigateToTab(TabId tab, ImageResult imageResult)
109109
{
110-
SelectedTabIndex = (int)diffuserType;
110+
SelectedTabIndex = (int)tab;
111111
await SelectedTabItem.NavigateAsync(imageResult);
112112
}
113113

114+
private enum TabId
115+
{
116+
TextToImage = 0,
117+
ImageToImage = 1,
118+
ImageInpaint = 2,
119+
PaintToImage = 3
120+
}
121+
114122
private ObservableCollection<ModelOptionsModel> CreateModelOptions(List<ModelOptions> onnxModelSets)
115123
{
116124
var models = onnxModelSets

OnnxStack.UI/Models/BatchOptionsModel.cs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class BatchOptionsModel : INotifyPropertyChanged
1515
private int _stepsValue = 1;
1616
private int _batchValue;
1717
private int _batchsValue = 1;
18-
private int _realtimeRefreshRate = 1000;
1918
private bool _disableHistory = true;
19+
private bool _isRealtimeEnabled;
2020

2121
public BatchOptionType BatchType
2222
{
@@ -42,12 +42,6 @@ public float Increment
4242
set { _increment = value; NotifyPropertyChanged(); }
4343
}
4444

45-
public bool IsAutomationEnabled
46-
{
47-
get { return _isAutomationEnabled; }
48-
set { _isAutomationEnabled = value; NotifyPropertyChanged(); }
49-
}
50-
5145
public int StepValue
5246
{
5347
get { return _stepValue; }
@@ -71,20 +65,36 @@ public int BatchsValue
7165
get { return _batchsValue; }
7266
set { _batchsValue = value; NotifyPropertyChanged(); }
7367
}
74-
75-
public int RealtimeRefreshRate
76-
{
77-
get { return _realtimeRefreshRate; }
78-
set { _realtimeRefreshRate = value; NotifyPropertyChanged(); }
79-
}
8068

8169
public bool DisableHistory
8270
{
8371
get { return _disableHistory; }
8472
set { _disableHistory = value; NotifyPropertyChanged(); }
8573
}
8674

75+
public bool IsAutomationEnabled
76+
{
77+
get { return _isAutomationEnabled; }
78+
set
79+
{
80+
_isAutomationEnabled = value;
81+
if (_isAutomationEnabled)
82+
IsRealtimeEnabled = false;
83+
NotifyPropertyChanged();
84+
}
85+
}
8786

87+
public bool IsRealtimeEnabled
88+
{
89+
get { return _isRealtimeEnabled; }
90+
set
91+
{
92+
_isRealtimeEnabled = value;
93+
if (_isRealtimeEnabled)
94+
IsAutomationEnabled = false;
95+
NotifyPropertyChanged();
96+
}
97+
}
8898

8999
#region INotifyPropertyChanged
90100
public event PropertyChangedEventHandler PropertyChanged;

OnnxStack.UI/Models/ModelSetViewModel.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class ModelSetViewModel : INotifyPropertyChanged
3636
private double _progressValue;
3737
private bool _isDownloading;
3838
private bool _hasChanged;
39-
private bool _enablePaintToImage;
39+
4040
public string Name
4141
{
4242
get { return _name; }
@@ -111,12 +111,6 @@ public bool EnableImageInpaintLegacy
111111
}
112112
}
113113

114-
public bool EnablePaintToImage
115-
{
116-
get { return _enablePaintToImage; }
117-
set { _enablePaintToImage = value; NotifyPropertyChanged(); }
118-
}
119-
120114
public int DeviceId
121115
{
122116
get { return _deviceId; }
@@ -209,8 +203,6 @@ public IEnumerable<DiffuserType> GetDiffusers()
209203
yield return DiffuserType.ImageInpaint;
210204
if (_enableImageInpaint && _enableImageInpaintLegacy)
211205
yield return DiffuserType.ImageInpaintLegacy;
212-
if (_enablePaintToImage)
213-
yield return DiffuserType.PaintToImage;
214206
}
215207

216208
#region INotifyPropertyChanged

0 commit comments

Comments
 (0)