Add Some Error Checking

This commit is contained in:
bmgjet 2024-12-24 23:27:06 +13:00 committed by GitHub
parent 9c2a7994a4
commit 48984f7be8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1370 additions and 1175 deletions

View File

@ -73,6 +73,13 @@
this.timer2 = new System.Windows.Forms.Timer(this.components); this.timer2 = new System.Windows.Forms.Timer(this.components);
this.Batch = new System.Windows.Forms.Button(); this.Batch = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.Weighttxt = new System.Windows.Forms.TextBox();
this.Weightlbl = new System.Windows.Forms.Label();
this.LoraButton = new System.Windows.Forms.Button();
this.Loratxt = new System.Windows.Forms.TextBox();
this.Loralbl = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.VideoRes = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
@ -204,9 +211,12 @@
"120"}); "120"});
this.FrameRate.Location = new System.Drawing.Point(6, 372); this.FrameRate.Location = new System.Drawing.Point(6, 372);
this.FrameRate.Margin = new System.Windows.Forms.Padding(2); this.FrameRate.Margin = new System.Windows.Forms.Padding(2);
this.FrameRate.MaxLength = 3;
this.FrameRate.Name = "FrameRate"; this.FrameRate.Name = "FrameRate";
this.FrameRate.Size = new System.Drawing.Size(80, 21); this.FrameRate.Size = new System.Drawing.Size(80, 21);
this.FrameRate.TabIndex = 11; this.FrameRate.TabIndex = 11;
this.FrameRate.Text = "24";
this.FrameRate.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
// //
// Frameslbl // Frameslbl
// //
@ -240,9 +250,12 @@
"896"}); "896"});
this.Resolution.Location = new System.Drawing.Point(166, 372); this.Resolution.Location = new System.Drawing.Point(166, 372);
this.Resolution.Margin = new System.Windows.Forms.Padding(2); this.Resolution.Margin = new System.Windows.Forms.Padding(2);
this.Resolution.MaxLength = 3;
this.Resolution.Name = "Resolution"; this.Resolution.Name = "Resolution";
this.Resolution.Size = new System.Drawing.Size(116, 21); this.Resolution.Size = new System.Drawing.Size(116, 21);
this.Resolution.TabIndex = 13; this.Resolution.TabIndex = 13;
this.Resolution.Text = "384";
this.Resolution.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
// //
// Aspectlbl // Aspectlbl
// //
@ -264,9 +277,12 @@
"1:1"}); "1:1"});
this.AspectRatio.Location = new System.Drawing.Point(93, 372); this.AspectRatio.Location = new System.Drawing.Point(93, 372);
this.AspectRatio.Margin = new System.Windows.Forms.Padding(2); this.AspectRatio.Margin = new System.Windows.Forms.Padding(2);
this.AspectRatio.MaxLength = 5;
this.AspectRatio.Name = "AspectRatio"; this.AspectRatio.Name = "AspectRatio";
this.AspectRatio.Size = new System.Drawing.Size(70, 21); this.AspectRatio.Size = new System.Drawing.Size(70, 21);
this.AspectRatio.TabIndex = 15; this.AspectRatio.TabIndex = 15;
this.AspectRatio.Text = "16:9";
this.AspectRatio.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.AspectRatio_KeyPress);
// //
// Motionlbl // Motionlbl
// //
@ -289,9 +305,12 @@
"4"}); "4"});
this.Motion.Location = new System.Drawing.Point(380, 372); this.Motion.Location = new System.Drawing.Point(380, 372);
this.Motion.Margin = new System.Windows.Forms.Padding(2); this.Motion.Margin = new System.Windows.Forms.Padding(2);
this.Motion.MaxLength = 4;
this.Motion.Name = "Motion"; this.Motion.Name = "Motion";
this.Motion.Size = new System.Drawing.Size(76, 21); this.Motion.Size = new System.Drawing.Size(61, 21);
this.Motion.TabIndex = 17; this.Motion.TabIndex = 17;
this.Motion.Text = "auto";
this.Motion.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberAndAuto);
// //
// Directionlbl // Directionlbl
// //
@ -315,14 +334,17 @@
"down"}); "down"});
this.Direction.Location = new System.Drawing.Point(285, 372); this.Direction.Location = new System.Drawing.Point(285, 372);
this.Direction.Margin = new System.Windows.Forms.Padding(2); this.Direction.Margin = new System.Windows.Forms.Padding(2);
this.Direction.MaxLength = 4;
this.Direction.Name = "Direction"; this.Direction.Name = "Direction";
this.Direction.Size = new System.Drawing.Size(92, 21); this.Direction.Size = new System.Drawing.Size(92, 21);
this.Direction.TabIndex = 19; this.Direction.TabIndex = 19;
this.Direction.Text = "auto";
this.Direction.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberAndAuto);
// //
// LowMemoryMode // LowMemoryMode
// //
this.LowMemoryMode.AutoSize = true; this.LowMemoryMode.AutoSize = true;
this.LowMemoryMode.Location = new System.Drawing.Point(119, 418); this.LowMemoryMode.Location = new System.Drawing.Point(113, 425);
this.LowMemoryMode.Margin = new System.Windows.Forms.Padding(2); this.LowMemoryMode.Margin = new System.Windows.Forms.Padding(2);
this.LowMemoryMode.Name = "LowMemoryMode"; this.LowMemoryMode.Name = "LowMemoryMode";
this.LowMemoryMode.Size = new System.Drawing.Size(142, 17); this.LowMemoryMode.Size = new System.Drawing.Size(142, 17);
@ -333,7 +355,7 @@
// Offloadlbl // Offloadlbl
// //
this.Offloadlbl.AutoSize = true; this.Offloadlbl.AutoSize = true;
this.Offloadlbl.Location = new System.Drawing.Point(3, 400); this.Offloadlbl.Location = new System.Drawing.Point(3, 403);
this.Offloadlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.Offloadlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Offloadlbl.Name = "Offloadlbl"; this.Offloadlbl.Name = "Offloadlbl";
this.Offloadlbl.Size = new System.Drawing.Size(100, 13); this.Offloadlbl.Size = new System.Drawing.Size(100, 13);
@ -342,17 +364,19 @@
// //
// GPUOffload // GPUOffload
// //
this.GPUOffload.Location = new System.Drawing.Point(6, 415); this.GPUOffload.Location = new System.Drawing.Point(6, 422);
this.GPUOffload.Margin = new System.Windows.Forms.Padding(2); this.GPUOffload.Margin = new System.Windows.Forms.Padding(2);
this.GPUOffload.MaxLength = 2;
this.GPUOffload.Name = "GPUOffload"; this.GPUOffload.Name = "GPUOffload";
this.GPUOffload.Size = new System.Drawing.Size(95, 20); this.GPUOffload.Size = new System.Drawing.Size(95, 20);
this.GPUOffload.TabIndex = 24; this.GPUOffload.TabIndex = 24;
this.GPUOffload.Text = "0"; this.GPUOffload.Text = "0";
this.GPUOffload.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
// //
// Samplerlbl // Samplerlbl
// //
this.Samplerlbl.AutoSize = true; this.Samplerlbl.AutoSize = true;
this.Samplerlbl.Location = new System.Drawing.Point(3, 439); this.Samplerlbl.Location = new System.Drawing.Point(3, 447);
this.Samplerlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.Samplerlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Samplerlbl.Name = "Samplerlbl"; this.Samplerlbl.Name = "Samplerlbl";
this.Samplerlbl.Size = new System.Drawing.Size(89, 13); this.Samplerlbl.Size = new System.Drawing.Size(89, 13);
@ -361,17 +385,19 @@
// //
// Steps // Steps
// //
this.Steps.Location = new System.Drawing.Point(11, 470); this.Steps.Location = new System.Drawing.Point(11, 480);
this.Steps.Margin = new System.Windows.Forms.Padding(2); this.Steps.Margin = new System.Windows.Forms.Padding(2);
this.Steps.MaxLength = 2;
this.Steps.Name = "Steps"; this.Steps.Name = "Steps";
this.Steps.Size = new System.Drawing.Size(95, 20); this.Steps.Size = new System.Drawing.Size(95, 20);
this.Steps.TabIndex = 27; this.Steps.TabIndex = 27;
this.Steps.Text = "25"; this.Steps.Text = "25";
this.Steps.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
// //
// Stepslbl // Stepslbl
// //
this.Stepslbl.AutoSize = true; this.Stepslbl.AutoSize = true;
this.Stepslbl.Location = new System.Drawing.Point(5, 455); this.Stepslbl.Location = new System.Drawing.Point(5, 463);
this.Stepslbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.Stepslbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Stepslbl.Name = "Stepslbl"; this.Stepslbl.Name = "Stepslbl";
this.Stepslbl.Size = new System.Drawing.Size(37, 13); this.Stepslbl.Size = new System.Drawing.Size(37, 13);
@ -380,17 +406,19 @@
// //
// Cfg // Cfg
// //
this.Cfg.Location = new System.Drawing.Point(113, 470); this.Cfg.Location = new System.Drawing.Point(113, 480);
this.Cfg.Margin = new System.Windows.Forms.Padding(2); this.Cfg.Margin = new System.Windows.Forms.Padding(2);
this.Cfg.MaxLength = 4;
this.Cfg.Name = "Cfg"; this.Cfg.Name = "Cfg";
this.Cfg.Size = new System.Drawing.Size(95, 20); this.Cfg.Size = new System.Drawing.Size(95, 20);
this.Cfg.TabIndex = 29; this.Cfg.TabIndex = 29;
this.Cfg.Text = "7.0"; this.Cfg.Text = "7.0";
this.Cfg.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Cfg_KeyPress);
// //
// Cfglbl // Cfglbl
// //
this.Cfglbl.AutoSize = true; this.Cfglbl.AutoSize = true;
this.Cfglbl.Location = new System.Drawing.Point(110, 455); this.Cfglbl.Location = new System.Drawing.Point(110, 463);
this.Cfglbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.Cfglbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Cfglbl.Name = "Cfglbl"; this.Cfglbl.Name = "Cfglbl";
this.Cfglbl.Size = new System.Drawing.Size(26, 13); this.Cfglbl.Size = new System.Drawing.Size(26, 13);
@ -399,17 +427,19 @@
// //
// Seed // Seed
// //
this.Seed.Location = new System.Drawing.Point(215, 470); this.Seed.Location = new System.Drawing.Point(215, 480);
this.Seed.Margin = new System.Windows.Forms.Padding(2); this.Seed.Margin = new System.Windows.Forms.Padding(2);
this.Seed.MaxLength = 6;
this.Seed.Name = "Seed"; this.Seed.Name = "Seed";
this.Seed.Size = new System.Drawing.Size(95, 20); this.Seed.Size = new System.Drawing.Size(95, 20);
this.Seed.TabIndex = 31; this.Seed.TabIndex = 31;
this.Seed.Text = "42"; this.Seed.Text = "42";
this.Seed.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
// //
// Seedlbl // Seedlbl
// //
this.Seedlbl.AutoSize = true; this.Seedlbl.AutoSize = true;
this.Seedlbl.Location = new System.Drawing.Point(212, 455); this.Seedlbl.Location = new System.Drawing.Point(212, 463);
this.Seedlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.Seedlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Seedlbl.Name = "Seedlbl"; this.Seedlbl.Name = "Seedlbl";
this.Seedlbl.Size = new System.Drawing.Size(35, 13); this.Seedlbl.Size = new System.Drawing.Size(35, 13);
@ -419,7 +449,7 @@
// Schedulerlbl // Schedulerlbl
// //
this.Schedulerlbl.AutoSize = true; this.Schedulerlbl.AutoSize = true;
this.Schedulerlbl.Location = new System.Drawing.Point(315, 455); this.Schedulerlbl.Location = new System.Drawing.Point(315, 463);
this.Schedulerlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.Schedulerlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Schedulerlbl.Name = "Schedulerlbl"; this.Schedulerlbl.Name = "Schedulerlbl";
this.Schedulerlbl.Size = new System.Drawing.Size(58, 13); this.Schedulerlbl.Size = new System.Drawing.Size(58, 13);
@ -434,17 +464,17 @@
"Euler", "Euler",
"Euler A", "Euler A",
"DPM++", "DPM++",
"PNDM", "PNDM"});
"DDIM"}); this.Scheduler.Location = new System.Drawing.Point(318, 480);
this.Scheduler.Location = new System.Drawing.Point(318, 470);
this.Scheduler.Margin = new System.Windows.Forms.Padding(2); this.Scheduler.Margin = new System.Windows.Forms.Padding(2);
this.Scheduler.Name = "Scheduler"; this.Scheduler.Name = "Scheduler";
this.Scheduler.Size = new System.Drawing.Size(138, 21); this.Scheduler.Size = new System.Drawing.Size(138, 21);
this.Scheduler.TabIndex = 32; this.Scheduler.TabIndex = 32;
this.Scheduler.Text = "DDIM";
// //
// GenerateButton // GenerateButton
// //
this.GenerateButton.Location = new System.Drawing.Point(6, 508); this.GenerateButton.Location = new System.Drawing.Point(6, 513);
this.GenerateButton.Margin = new System.Windows.Forms.Padding(2); this.GenerateButton.Margin = new System.Windows.Forms.Padding(2);
this.GenerateButton.Name = "GenerateButton"; this.GenerateButton.Name = "GenerateButton";
this.GenerateButton.Size = new System.Drawing.Size(544, 30); this.GenerateButton.Size = new System.Drawing.Size(544, 30);
@ -456,7 +486,7 @@
// PlayVideo // PlayVideo
// //
this.PlayVideo.Enabled = false; this.PlayVideo.Enabled = false;
this.PlayVideo.Location = new System.Drawing.Point(6, 543); this.PlayVideo.Location = new System.Drawing.Point(6, 548);
this.PlayVideo.Name = "PlayVideo"; this.PlayVideo.Name = "PlayVideo";
this.PlayVideo.Size = new System.Drawing.Size(544, 24); this.PlayVideo.Size = new System.Drawing.Size(544, 24);
this.PlayVideo.TabIndex = 35; this.PlayVideo.TabIndex = 35;
@ -501,7 +531,7 @@
// //
// RunJobs // RunJobs
// //
this.RunJobs.Location = new System.Drawing.Point(556, 488); this.RunJobs.Location = new System.Drawing.Point(556, 493);
this.RunJobs.Name = "RunJobs"; this.RunJobs.Name = "RunJobs";
this.RunJobs.Size = new System.Drawing.Size(228, 79); this.RunJobs.Size = new System.Drawing.Size(228, 79);
this.RunJobs.TabIndex = 39; this.RunJobs.TabIndex = 39;
@ -516,7 +546,7 @@
// //
// Batch // Batch
// //
this.Batch.Location = new System.Drawing.Point(465, 470); this.Batch.Location = new System.Drawing.Point(465, 480);
this.Batch.Name = "Batch"; this.Batch.Name = "Batch";
this.Batch.Size = new System.Drawing.Size(67, 21); this.Batch.Size = new System.Drawing.Size(67, 21);
this.Batch.TabIndex = 40; this.Batch.TabIndex = 40;
@ -526,6 +556,13 @@
// //
// panel1 // panel1
// //
this.panel1.Controls.Add(this.Weighttxt);
this.panel1.Controls.Add(this.Weightlbl);
this.panel1.Controls.Add(this.LoraButton);
this.panel1.Controls.Add(this.Loratxt);
this.panel1.Controls.Add(this.Loralbl);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.VideoRes);
this.panel1.Controls.Add(this.Batch); this.panel1.Controls.Add(this.Batch);
this.panel1.Controls.Add(this.Schedulerlbl); this.panel1.Controls.Add(this.Schedulerlbl);
this.panel1.Controls.Add(this.Scheduler); this.panel1.Controls.Add(this.Scheduler);
@ -562,14 +599,93 @@
this.panel1.Controls.Add(this.pictureBox1); this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(6, 6); this.panel1.Location = new System.Drawing.Point(6, 6);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(544, 497); this.panel1.Size = new System.Drawing.Size(544, 507);
this.panel1.TabIndex = 41; this.panel1.TabIndex = 41;
// //
// Weighttxt
//
this.Weighttxt.Location = new System.Drawing.Point(330, 422);
this.Weighttxt.Margin = new System.Windows.Forms.Padding(2);
this.Weighttxt.MaxLength = 4;
this.Weighttxt.Name = "Weighttxt";
this.Weighttxt.Size = new System.Drawing.Size(43, 20);
this.Weighttxt.TabIndex = 47;
this.Weighttxt.Text = "1.0";
this.Weighttxt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Cfg_KeyPress);
//
// Weightlbl
//
this.Weightlbl.AutoSize = true;
this.Weightlbl.Location = new System.Drawing.Point(282, 426);
this.Weightlbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Weightlbl.Name = "Weightlbl";
this.Weightlbl.Size = new System.Drawing.Size(44, 13);
this.Weightlbl.TabIndex = 46;
this.Weightlbl.Text = "Weight:";
//
// LoraButton
//
this.LoraButton.Location = new System.Drawing.Point(445, 422);
this.LoraButton.Margin = new System.Windows.Forms.Padding(2);
this.LoraButton.Name = "LoraButton";
this.LoraButton.Size = new System.Drawing.Size(87, 22);
this.LoraButton.TabIndex = 45;
this.LoraButton.Text = "Select";
this.LoraButton.UseVisualStyleBackColor = true;
this.LoraButton.Click += new System.EventHandler(this.LoraButton_Click);
//
// Loratxt
//
this.Loratxt.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.Loratxt.Location = new System.Drawing.Point(318, 400);
this.Loratxt.Margin = new System.Windows.Forms.Padding(2);
this.Loratxt.Name = "Loratxt";
this.Loratxt.ReadOnly = true;
this.Loratxt.Size = new System.Drawing.Size(215, 20);
this.Loratxt.TabIndex = 44;
//
// Loralbl
//
this.Loralbl.AutoSize = true;
this.Loralbl.Location = new System.Drawing.Point(282, 403);
this.Loralbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.Loralbl.Name = "Loralbl";
this.Loralbl.Size = new System.Drawing.Size(31, 13);
this.Loralbl.TabIndex = 43;
this.Loralbl.Text = "Lora:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(447, 357);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(84, 13);
this.label1.TabIndex = 42;
this.label1.Text = "Mp4 Resolution:";
//
// VideoRes
//
this.VideoRes.FormattingEnabled = true;
this.VideoRes.Items.AddRange(new object[] {
"auto",
"576, 448",
"512, 288",
"720, 540"});
this.VideoRes.Location = new System.Drawing.Point(445, 372);
this.VideoRes.Margin = new System.Windows.Forms.Padding(2);
this.VideoRes.MaxLength = 8;
this.VideoRes.Name = "VideoRes";
this.VideoRes.Size = new System.Drawing.Size(91, 21);
this.VideoRes.TabIndex = 41;
this.VideoRes.Text = "auto";
this.VideoRes.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.VideoRes_KeyPress);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(555, 572); this.ClientSize = new System.Drawing.Size(555, 577);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.RunJobs); this.Controls.Add(this.RunJobs);
this.Controls.Add(this.RemoveJob); this.Controls.Add(this.RemoveJob);
@ -638,6 +754,13 @@
private System.Windows.Forms.Timer timer2; private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Button Batch; private System.Windows.Forms.Button Batch;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox VideoRes;
private System.Windows.Forms.TextBox Weighttxt;
private System.Windows.Forms.Label Weightlbl;
private System.Windows.Forms.Button LoraButton;
private System.Windows.Forms.TextBox Loratxt;
private System.Windows.Forms.Label Loralbl;
} }
} }

View File

@ -25,39 +25,44 @@ namespace Ruyi_GUI
InitializeComponent(); InitializeComponent();
PythonCode = Encoding.UTF8.GetString(Convert.FromBase64String(Decompress(Convert.FromBase64String("xRprb+M28nuA/AeeroClrqrdpO0eEEAf0tjZGhdvgiS3/ZAzBMaibG5kUadHNmng/34zJCVRD9vpXoAL0CbivIfD4cxw+ToVWUFEfnjA1Z+FyBarw4MoE2tyNb0genm6pkuml0MeRWXOsrwC2pMyZtmY54uMFexmsWIhLrhErp8mC5YXGY37COOr2Y2IH1k2K+OC5wVLDeKrz+OZ8TkeT5tPR6si1mxJFyKJKlUuceEMFjQCyE3ySGRrQ92zi+mVtOcqE6BaLoA7rn3hORfJTIQs/oMXK4B+ZYsCljSvnEagfQL4uSfdVDGMBQ2DiMeM0Fx9GKiaeFUulzxZRnTBglV5X5HmCU3zlSiCUHxLkFSjZ+Uz90JaUO++XDywAjiuUzC8oju9uZqc3QbXp7fTy+DXo2OXLAFpEYscfB1kFN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ktac2iQ15tN2x2d3J7SEi33t3lUH4eKWhJh+sWUhC4++uiAi48+Nl41NZy3orDLpNneTubwevEZRDFddoPZKFW8FQ9DqNAWFEqTKhR6U8nhM7GPzQetXWdYirOt8dXs3btquJUIONqBWTfueHbpFXDDZe2oZjeSJ3pYDfn8s12N4Vejt9eAnO7RYfsL1Zsqgw9a2zVpPXe9qVzsJHYEg9lnfJfcOmJNth1BGKtLBi01hRKtqtM+VQu2miE73pomJeQAnMrb+D+0yqxQ32qqLEtHaDi1IokIlhneNtpLrWcYHy9ku7X0/n1zTKFt8dY84cE9LaDLqPrbH/dhOKS+STTXv/nkSGXbI33ZJ/VzkWt+qDGS0Xtozww+ZjX52tXlJvxhyvXND3z6qpOsb7dSo1MX/JhUg/q2dPXf+jEBcu2fPLXlpS1HsPrlAgr5u7njEgOg72IFcczGoKn4muc8Y5u3CdfXgi46pSXGpN3oRqEvW6fF4FS3N9ycuz26XSPdrfPOAT7DY92BoedeHbbz6E0KTV71zHCXQ7rz0F0Mdnpm26x0v0Y98/qT09drtZ3ZTl91skLr2DRYK+NJza9qiwasiowKrIqdBlqnSAmtv0yMkocU7itIrVQG9yJamoaX64AnEcuYxJFvnljvwe+uJaTWwswzRi+BHqgw/X7+GRqhSczmsxozOZ56S/9/5A/zHwS8LoPUD/XqtgMe1awFLhC8Ve3eQ75qndtkkM5HI60TMFjTBwb0ud3Cgpz8BBVYIB587MeAT/efHtgqjbmkJ9QlUZr7x784/wU=")))); PythonCode = Encoding.UTF8.GetString(Convert.FromBase64String(Decompress(Convert.FromBase64String("xRprb+M28nuA/AeeroClrqrdpO0eEEAf0tjZGhdvgiS3/ZAzBMaibG5kUadHNmng/34zJCVRD9vpXoAL0CbivIfD4cxw+ToVWUFEfnjA1Z+FyBarw4MoE2tyNb0genm6pkuml0MeRWXOsrwC2pMyZtmY54uMFexmsWIhLrhErp8mC5YXGY37COOr2Y2IH1k2K+OC5wVLDeKrz+OZ8TkeT5tPR6si1mxJFyKJKlUuceEM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wVejCsxPugMZqUnI6ITc1QMOeZqacUfvIN3NdQIeqRBpqNX3q+g32gvGmK0dS+aQQE9sFRrojrMEkPlE3pNfj47Jj6Q7yoPLjTzB5vdmu3dAOp9LODIZwPBgPbedjdJCZByCDxz/jYd4KOrvlZr2+KROdncf5p6yA7oCODN1uls6aFrMIXqk/QMZcelIUiWzmjzjiktac2iQ15tN2x2d3J7SEi33t3lUH4eKWhJh+sWUhC4++uiAi48+Nl41NZy3orDLpNneTubwevEZRDFddoPZKFW8FQ9DqNAWFEqTKhR6U8nhM7GPzQetXWdYirOt8dXs3btquJUIONqBWTfueHbpFXDDZe2oZjeSJ3pYDfn8s12N4Vejt9eAnO7RYfsL1Zsqgw9a2zVpPXe9qVzsJHYEg9lnfJfcOmJNth1BGKtLBi01hRKtqtM+VQu2miE73pomJeQAnMrb+D+0yqxQ32qqLEtHaDi1IokIlhneNtpLrWcYHy9ku7X0/n1zTKFt8dY84cE9LaDLqPrbH/dhOKS+STTXv/nkSGXbI33ZJ/VzkWt+qDGS0Xtozww+ZjX52tXlJvxhyvXND3z6qpOsb7dSo1MX/JhUg/q2dPXf+jEBcu2fPLXlpS1HsPrlAgr5u7njEgOg72IFcczGoKn4muc8Y5u3CdfXgi46pSXGpN3oRqEvW6fF4FS3N9ycuz26XSPdrfPOAT7DY92BoedeHbbz6E0KTV71zHCXQ7rz0F0Mdnpm26x0v0Y98/qT09drtZ3ZTl91skLr2DRYK+NJza9qiwasiowKrIqdBlqnSAmtv0yMkocU7itIrVQG9yJamoaX64AnEcuYxJFvnljvwe+uJaTWwswzRi+BHqgw/X7+GRqhSczmsxozOZ56S/9/5A/zHwS8LoPUD/XqtgMe1awFLhC8Ve3eQ75qndtkkM5HI60TMFjTBwb0ud3Cgpz8BBVYIB587MeAT/efHtgqjbmkJ9QlUZr7x784/wU="))));
if (File.Exists("Config.cfg")) { LoadSettings(File.ReadAllText("Config.cfg")); } if (File.Exists("Config.cfg")) { LoadSettings(File.ReadAllText("Config.cfg")); }
else else { SaveSettings(); }
if(!File.Exists("environment.bat"))
{ {
FrameRate.SelectedIndex = 0; MessageBox.Show("environment.bat file missing, Is this exe being ran from Forge Install folder?","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
AspectRatio.SelectedIndex = 0;
Resolution.SelectedIndex = 0;
Direction.SelectedIndex = 0;
Motion.SelectedIndex = 0;
Scheduler.SelectedIndex = 0;
SaveSettings();
} }
} }
private string SettingsString() { return Img1.Text + "|" + Img2.Text + "|" + VideoOut.Text + "|" + FrameRate.SelectedIndex + "|" + AspectRatio.SelectedIndex + "|" + Resolution.SelectedIndex + "|" + Direction.SelectedIndex + "|" + Motion.SelectedIndex + "|" + GPUOffload.Text + "|" + LowMemoryMode.Checked + "|" + Steps.Text + "|" + Cfg.Text + "|" + Seed.Text + "|" + Scheduler.SelectedIndex; } private string SettingsString() { return Img1.Text + "|" + Img2.Text + "|" + VideoOut.Text + "|" + FrameRate.Text + "|" + AspectRatio.Text + "|" + Resolution.Text + "|" + Direction.Text + "|" + Motion.Text + "|" + GPUOffload.Text + "|" + LowMemoryMode.Checked + "|" + Steps.Text + "|" + Cfg.Text + "|" + Seed.Text + "|" + Scheduler.Text + "|" + VideoRes.Text + "|" + Loratxt.Text + "|" + Weighttxt.Text; }
private void SaveSettings() { File.WriteAllText("Config.cfg", SettingsString()); } private void SaveSettings() { File.WriteAllText("Config.cfg", SettingsString()); }
private void LoadSettings(string Settings) private void LoadSettings(string Settings)
{ {
string[] SSettings = Settings.Split('|'); try
Img1.Text = SSettings[0]; {
Img2.Text = SSettings[1]; string[] SSettings = Settings.Split('|');
VideoOut.Text = SSettings[2]; Img1.Text = SSettings[0];
FrameRate.SelectedIndex = int.Parse(SSettings[3]); Img2.Text = SSettings[1];
AspectRatio.SelectedIndex = int.Parse(SSettings[4]); VideoOut.Text = SSettings[2];
Resolution.SelectedIndex = int.Parse(SSettings[5]); FrameRate.Text = SSettings[3];
Direction.SelectedIndex = int.Parse(SSettings[6]); AspectRatio.Text = SSettings[4];
Motion.SelectedIndex = int.Parse(SSettings[7]); Resolution.Text = SSettings[5];
GPUOffload.Text = SSettings[8]; Direction.Text = SSettings[6];
LowMemoryMode.Checked = bool.Parse(SSettings[9]); Motion.Text = SSettings[7];
Steps.Text = SSettings[10]; GPUOffload.Text = SSettings[8];
Cfg.Text = SSettings[11]; LowMemoryMode.Checked = bool.Parse(SSettings[9]);
Seed.Text = SSettings[12]; Steps.Text = SSettings[10];
Scheduler.SelectedIndex = int.Parse(SSettings[13]); Cfg.Text = SSettings[11];
Seed.Text = SSettings[12];
Scheduler.Text = SSettings[13];
VideoRes.Text = SSettings[14];
Loratxt.Text = SSettings[15];
Weighttxt.Text = SSettings[16];
}
catch
{
MessageBox.Show("Fault loading Config.cfg, Maybe Try Delete it so it can regenerate.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
if (File.Exists(Img1.Text)) { pictureBox1.BackgroundImage = new Bitmap(Img1.Text); } if (File.Exists(Img1.Text)) { pictureBox1.BackgroundImage = new Bitmap(Img1.Text); }
if (File.Exists(Img2.Text)) { pictureBox2.BackgroundImage = new Bitmap(Img2.Text); } if (File.Exists(Img2.Text)) { pictureBox2.BackgroundImage = new Bitmap(Img2.Text); }
else { pictureBox2.BackgroundImage = null; } else { pictureBox2.BackgroundImage = null; }
@ -142,15 +147,23 @@ namespace Ruyi_GUI
private void GenerateButton_Click(object sender, EventArgs e) private void GenerateButton_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(VideoOut.Text)) { MessageBox.Show("You Must Select A Video Output", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ValidateInOut())
if (string.IsNullOrEmpty(Img1.Text)) { MessageBox.Show("You Must Select A Input Image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } {
ExecuteCommand(); if (this.Width == 810) { this.Width = 575; JobList.Items.Clear(); }
ExecuteCommand();
}
} }
private void ExecuteCommand() private void ExecuteCommand()
{ {
if (!Directory.Exists("Ruyi-Models"))
{
MessageBox.Show("Missing Ruyi-Models Folder", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string Image2 = string.IsNullOrEmpty(Img2.Text) ? "None" : @"""" + Img2.Text.Replace(@"\", @"\\") + @""""; string Image2 = string.IsNullOrEmpty(Img2.Text) ? "None" : @"""" + Img2.Text.Replace(@"\", @"\\") + @"""";
string CallCode = PythonCode.Replace("{$IMAGE1}", Img1.Text.Replace(@"\", @"\\")).Replace("{$IMAGE2}", Image2).Replace("{$VIDEO}", VideoOut.Text.Replace(@"\", @"\\")).Replace("{$FRAMES}", FrameRate.Text).Replace("{$RES}", Resolution.Text).Replace("{$ASPECT}", AspectRatio.Text).Replace("{$MOTION}", Motion.Text).Replace("{$DIRECTION}", Direction.Text).Replace("{$STEPS}", Steps.Text).Replace("{$CFG}", Cfg.Text).Replace("{$SCHEDULER}", Scheduler.Text).Replace("{$LOWMEM}", LowMemoryMode.Checked.ToString()).Replace("{$OFFLOAD}", GPUOffload.Text).Replace("{$SEED}", Seed.Text); string Lora = string.IsNullOrEmpty(Loratxt.Text) ? "None" : @"""" + Loratxt.Text.Replace(@"\", @"\\") + @"""";
string CallCode = PythonCode.Replace("{$IMAGE1}", Img1.Text.Replace(@"\", @"\\")).Replace("{$IMAGE2}", Image2).Replace("{$VIDEO}", VideoOut.Text.Replace(@"\", @"\\")).Replace("{$FRAMES}", FrameRate.Text).Replace("{$RES}", Resolution.Text).Replace("{$ASPECT}", AspectRatio.Text).Replace("{$MOTION}", Motion.Text).Replace("{$DIRECTION}", Direction.Text).Replace("{$STEPS}", Steps.Text).Replace("{$CFG}", Cfg.Text).Replace("{$SCHEDULER}", Scheduler.Text).Replace("{$LOWMEM}", LowMemoryMode.Checked.ToString()).Replace("{$OFFLOAD}", GPUOffload.Text).Replace("{$SEED}", Seed.Text).Replace("video_size = None", "video_size = " + VideoRes.Text.Replace("auto","None")).Replace("lora_path = None", "lora_path = " + Lora).Replace("lora_weight = 1.0", "lora_weight = " + Weighttxt.Text);
File.WriteAllText(Path.Combine("Ruyi-Models", "i2v.py"), CallCode); File.WriteAllText(Path.Combine("Ruyi-Models", "i2v.py"), CallCode);
if (File.Exists(VideoOut.Text)) { File.Move(VideoOut.Text, VideoOut.Text.Replace(".mp4", "-" + GetTimestamp() + ".mp4")); } if (File.Exists(VideoOut.Text)) { File.Move(VideoOut.Text, VideoOut.Text.Replace(".mp4", "-" + GetTimestamp() + ".mp4")); }
Task.Run(() => Task.Run(() =>
@ -236,14 +249,38 @@ namespace Ruyi_GUI
} }
} }
private bool ValidateInOut()
{
if (string.IsNullOrEmpty(VideoOut.Text)) { MessageBox.Show("You Must Select A Video Output", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Img1.Text)) { MessageBox.Show("You Must Select A Input Image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(FrameRate.Text)) { MessageBox.Show("Frame Rate Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(AspectRatio.Text)) { MessageBox.Show("Aspect Ratio Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Resolution.Text)) { MessageBox.Show("Resolution Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Direction.Text)) { MessageBox.Show("Direction Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Motion.Text)) { MessageBox.Show("Motion Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(VideoRes.Text)) { MessageBox.Show("Mp4 Resolution Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(GPUOffload.Text)) { MessageBox.Show("GPU Offload Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Steps.Text)) { MessageBox.Show("Steps Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Cfg.Text)) { MessageBox.Show("Cfg Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Seed.Text)) { MessageBox.Show("Seed Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Scheduler.Text)) { MessageBox.Show("Scheduler Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (string.IsNullOrEmpty(Weighttxt.Text)) { MessageBox.Show("Lora Weight Can't Be Null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if(!AspectRatio.Text.Contains(":")){ MessageBox.Show("Aspect Ratio Not Valid Format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
if (!VideoRes.Text.Contains(", ") && !VideoRes.Text.Contains("None")) { MessageBox.Show("Mp4 Resolution Not Valid Format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
return true;
}
private void AddJob_Click(object sender, EventArgs e) private void AddJob_Click(object sender, EventArgs e)
{ {
string Settings = SettingsString(); if (ValidateInOut())
string Job = GetHashString(Settings); {
if (JobList.Items.Contains(Job)) { return; } string Settings = SettingsString();
if (!Directory.Exists("Jobs")) { Directory.CreateDirectory("Jobs"); } string Job = GetHashString(Settings);
File.WriteAllText(Path.Combine("Jobs", Job), Settings); if (JobList.Items.Contains(Job)) { return; }
JobList.Items.Add(Job); if (!Directory.Exists("Jobs")) { Directory.CreateDirectory("Jobs"); }
File.WriteAllText(Path.Combine("Jobs", Job), Settings);
JobList.Items.Add(Job);
}
} }
private void RemoveJob_Click(object sender, EventArgs e) private void RemoveJob_Click(object sender, EventArgs e)
@ -301,9 +338,10 @@ namespace Ruyi_GUI
private void Batch_Click(object sender, EventArgs e) private void Batch_Click(object sender, EventArgs e)
{ {
if (this.Width == 810) { this.Width = 575; JobList.Items.Clear(); } if (this.Width == 810) { this.Width = 575; JobList.Items.Clear(); GenerateButton.Enabled = true; }
else else
{ {
GenerateButton.Enabled = false;
if (Directory.Exists("Jobs")) if (Directory.Exists("Jobs"))
{ {
DirectoryInfo d = new DirectoryInfo("Jobs"); DirectoryInfo d = new DirectoryInfo("Jobs");
@ -322,5 +360,39 @@ namespace Ruyi_GUI
this.Width = 810; this.Width = 810;
} }
} }
private void AspectRatio_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar) && e.KeyChar != ':';
}
private void NumberOnly(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
}
private void Cfg_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar) && e.KeyChar != '.';
}
private void NumberAndAuto(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar) && e.KeyChar != 'a' && e.KeyChar != 'u' && e.KeyChar != 't' && e.KeyChar != 'o';
}
private void VideoRes_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar) && e.KeyChar != ',' && e.KeyChar != ' ' && e.KeyChar != 'N' && e.KeyChar != 'o' && e.KeyChar != 'n' && e.KeyChar != 'e' && e.KeyChar != 'a' && e.KeyChar != 'u' && e.KeyChar != 't';
}
private void LoraButton_Click(object sender, EventArgs e)
{
var dialog = new OpenFileDialog();
dialog.Title = "Select Lora File";
dialog.Filter = "safetensors (*.safetensors)|*.safetensors";
if (dialog.ShowDialog() == DialogResult.OK) { Loratxt.Text = dialog.FileName; }
dialog.Dispose();
}
} }
} }