Skip to content

Commit

Permalink
Merge pull request #18 from ForserX/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ForserX authored May 13, 2023
2 parents 11b9eeb + 25c4038 commit 84dabac
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ dotnet_diagnostic.CA1806.severity = none

# CS4014: Так как этот вызов не ожидается, выполнение существующего метода продолжается до тех пор, пока вызов не будет завершен
dotnet_diagnostic.CS4014.severity = none

# SYSLIB0014: Тип или член устарел
dotnet_diagnostic.SYSLIB0014.severity = none
26 changes: 13 additions & 13 deletions data/repo/diffusion_scripts/sd_xbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,40 +396,40 @@ def MakeImage(self, pipe, mode : str, eta, prompt, prompt_neg, steps, width, hei

def ApplyArg(parser):
parser.add_argument(
"--model", type=str, help="Path to model checkpoint file", dest='mdlpath',
"--model", type=str, help="Path to model checkpoint (.ckpt or .safetensors)", dest='mdlpath',
)
parser.add_argument(
"--workdir", default=None, type=str, help="Path to model checkpoint file", dest='workdir',
"--workdir", default=None, type=str, help="Path to working directory", dest='workdir',
)
parser.add_argument(
"--width", type=int, help="Path to model checkpoint file", dest='width',
"--width", type=int, help="Image width", dest='width',
)
parser.add_argument(
"--guidance_scale", type=float, help="Path to model checkpoint file", dest='guidance_scale',
"--guidance_scale", type=float, help="guidance scale or CFG scale", dest='guidance_scale',
)
parser.add_argument(
"--height", type=int, help="Path to model checkpoint file", dest='height',
"--height", type=int, help="Image Height", dest='height',
)
parser.add_argument(
"--totalcount",
type=int, help="Path to model checkpoint file", dest='totalcount',
type=int, help="total images", dest='totalcount',
)
parser.add_argument(
"--steps",
type=int, help="Path to model checkpoint file", dest='steps',
type=int, help="scheduller steps per image", dest='steps',
)
parser.add_argument(
"--seed", type=int, help="Path to model checkpoint file", dest='seed',
"--seed", type=int, help="random seed", dest='seed',
)
parser.add_argument(
"--imgscale",
type=float, default=0.44, help="Path to model checkpoint file", dest='imgscale',
type=float, default=0.44, help="no description", dest='imgscale',
)
parser.add_argument(
"--prompt_neg", type=str, help="Path to model checkpoint file", dest='prompt_neg',
"--prompt_neg", type=str, help="negative prompt", dest='prompt_neg',
)
parser.add_argument(
"--prompt", type=str, help="Path to model checkpoint file", dest='prompt',
"--prompt", type=str, help="prompt", dest='prompt',
)
parser.add_argument(
"--outpath",
Expand Down Expand Up @@ -481,10 +481,10 @@ def ApplyArg(parser):
"--hypernetwork", type=str, help="hypernetwork path", dest='hypernetwork', default=None,
)
parser.add_argument(
"--cn_model", type=str, help="Path to model checkpoint file", dest='cn_model',
"--cn_model", type=str, help="controlnet model path", dest='cn_model',
)
parser.add_argument(
"--outfile", type=str, default="", help="Specify generation mode", dest='outfile',
"--outfile", type=str, default="", help="specify generation mode", dest='outfile',
)
parser.add_argument(
"--pose", type=str, default="", help="input pose image", dest='pose',
Expand Down
17 changes: 14 additions & 3 deletions ui-src/Debug/Dumper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using SD_FXUI.Debug;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
Expand Down Expand Up @@ -87,8 +88,18 @@ public static bool WriteDump(
}
public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
//System.Windows.Forms.MessageBox.Show("Unhandled exception!");
Notification.MsgBox(e.ExceptionObject.ToString());
string CallStack = e.ExceptionObject.ToString();

try
{
Log.SendMessageToFile(CallStack);
}
catch
{
// So sad...
}

Notification.MsgBox(CallStack);
WriteDump();
}

Expand Down
8 changes: 8 additions & 0 deletions ui-src/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Style", "IDE0044:Добавить модификатор только для чтения", Justification = "<Ожидание>", Scope = "member", Target = "~F:SD_FXUI.Utils.FileDownloader.Client")]
4 changes: 2 additions & 2 deletions ui-src/Utils/CMD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ public static async Task UpscalerRunner(int Size, string File)
Host.Print("\n Startup upscale..... \n");

string OutFile = File.Substring(0, File.Length - 4) + "_upscale.png";
ProcessHost.Start("-i " + File + " -o " + OutFile + DopCmd);
ProcessHost.Start("-i \"" + File + "\" -o \"" + OutFile + "\"" + DopCmd);
ProcessHost.Wait();

if (Helper.EnableGFPGAN)
{
Host ProcesHostTwo = new Host(FS.GetModelDir(), FileName);
OutFile = NewFile.Substring(0, NewFile.Length - 4) + "_upscale.png";
ProcesHostTwo.Start("-i " + NewFile + " -o " + OutFile + DopCmd);
ProcesHostTwo.Start("-i \"" + NewFile + "\" -o \"" + OutFile + "\"" + DopCmd);
ProcesHostTwo.Wait();
Helper.Form.UpdateViewImg(OutFile);
}
Expand Down
2 changes: 1 addition & 1 deletion ui-src/Utils/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static void OnDownloadProgressChanged(object sender, DownloadProgressCha

}

private static void OnDownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
private static void OnDownloadFileCompleted(object? sender, AsyncCompletedEventArgs e)
{
PreviousProgress = 0;
TaskCompleted = true;
Expand Down
4 changes: 2 additions & 2 deletions ui-src/Utils/Helper/HelperControlNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace SD_FXUI
{
class ControlNetBase
{
protected string Model;
protected string CNModel;
protected string Model = "";
protected string CNModel = "";
protected string BaseOutPath = FS.GetModelDir() + "controlnet/gen/";

public string GetModelPathSD()
Expand Down
8 changes: 6 additions & 2 deletions ui-src/Utils/Models/ModelImporter.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ namespace SD_FXUI.Utils
/// </summary>
public partial class SharkModelImporter : Window
{
string SwapText = "Enter the path to the file (.ckpt/.safetensors/.pt) or folder (diffusers)";

public SharkModelImporter()
{
InitializeComponent();

cbFrom.SelectedIndex = 0;
cbTo.SelectedIndex = 0;
cbBaseModel.SelectedIndex = 0;
cbPath.Text = SwapText;
}

bool PresetIs768()
{
return cbBaseModel.Text.Contains("768");
Expand Down Expand Up @@ -217,12 +221,12 @@ private void Grid_DragEnter(object sender, DragEventArgs e)
private void cbPathLost(object sender, RoutedEventArgs e)
{
if (cbPath.Text == "")
cbPath.Text = "Set your dir/url";
cbPath.Text = SwapText;
}

private void cbPathSet(object sender, RoutedEventArgs e)
{
if (cbPath.Text == "Set your dir/url")
if (cbPath.Text == SwapText)
cbPath.Text = "";
}
}
Expand Down

0 comments on commit 84dabac

Please sign in to comment.