Compare commits

...

4 Commits

Author SHA1 Message Date
bmgjet 5aa6b7b700
External Py, Update Checker, Python Crash Checker 2024-12-25 01:27:28 +13:00
bmgjet 94e97027ad
Use External Python File Instead Of Embedded, 2024-12-25 01:26:31 +13:00
bmgjet cd94663283
Add Error Checking, Lora Support, Mp4 Res Support 2024-12-24 23:27:54 +13:00
bmgjet 48984f7be8
Add Some Error Checking 2024-12-24 23:27:06 +13:00
5 changed files with 1537 additions and 1175 deletions

View File

@ -73,6 +73,15 @@
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.Batch = new System.Windows.Forms.Button();
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();
this.timer3 = new System.Windows.Forms.Timer(this.components);
this.Updates = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.panel1.SuspendLayout();
@ -204,9 +213,12 @@
"120"});
this.FrameRate.Location = new System.Drawing.Point(6, 372);
this.FrameRate.Margin = new System.Windows.Forms.Padding(2);
this.FrameRate.MaxLength = 3;
this.FrameRate.Name = "FrameRate";
this.FrameRate.Size = new System.Drawing.Size(80, 21);
this.FrameRate.TabIndex = 11;
this.FrameRate.Text = "24";
this.FrameRate.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
//
// Frameslbl
//
@ -240,9 +252,12 @@
"896"});
this.Resolution.Location = new System.Drawing.Point(166, 372);
this.Resolution.Margin = new System.Windows.Forms.Padding(2);
this.Resolution.MaxLength = 3;
this.Resolution.Name = "Resolution";
this.Resolution.Size = new System.Drawing.Size(116, 21);
this.Resolution.TabIndex = 13;
this.Resolution.Text = "384";
this.Resolution.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
//
// Aspectlbl
//
@ -258,15 +273,23 @@
//
this.AspectRatio.FormattingEnabled = true;
this.AspectRatio.Items.AddRange(new object[] {
"21:9",
"16:9",
"9:16",
"4:3",
"1:1"});
"3:2",
"1:1",
"2:3",
"3:4",
"9:16",
"9:21"});
this.AspectRatio.Location = new System.Drawing.Point(93, 372);
this.AspectRatio.Margin = new System.Windows.Forms.Padding(2);
this.AspectRatio.MaxLength = 5;
this.AspectRatio.Name = "AspectRatio";
this.AspectRatio.Size = new System.Drawing.Size(70, 21);
this.AspectRatio.TabIndex = 15;
this.AspectRatio.Text = "16:9";
this.AspectRatio.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.AspectRatio_KeyPress);
//
// Motionlbl
//
@ -289,9 +312,12 @@
"4"});
this.Motion.Location = new System.Drawing.Point(380, 372);
this.Motion.Margin = new System.Windows.Forms.Padding(2);
this.Motion.MaxLength = 4;
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.Text = "auto";
this.Motion.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberAndAuto);
//
// Directionlbl
//
@ -315,14 +341,17 @@
"down"});
this.Direction.Location = new System.Drawing.Point(285, 372);
this.Direction.Margin = new System.Windows.Forms.Padding(2);
this.Direction.MaxLength = 4;
this.Direction.Name = "Direction";
this.Direction.Size = new System.Drawing.Size(92, 21);
this.Direction.TabIndex = 19;
this.Direction.Text = "auto";
this.Direction.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberAndAuto);
//
// LowMemoryMode
//
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.Name = "LowMemoryMode";
this.LowMemoryMode.Size = new System.Drawing.Size(142, 17);
@ -333,7 +362,7 @@
// Offloadlbl
//
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.Name = "Offloadlbl";
this.Offloadlbl.Size = new System.Drawing.Size(100, 13);
@ -342,17 +371,19 @@
//
// 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.MaxLength = 2;
this.GPUOffload.Name = "GPUOffload";
this.GPUOffload.Size = new System.Drawing.Size(95, 20);
this.GPUOffload.TabIndex = 24;
this.GPUOffload.Text = "0";
this.GPUOffload.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
//
// Samplerlbl
//
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.Name = "Samplerlbl";
this.Samplerlbl.Size = new System.Drawing.Size(89, 13);
@ -361,17 +392,19 @@
//
// 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.MaxLength = 2;
this.Steps.Name = "Steps";
this.Steps.Size = new System.Drawing.Size(95, 20);
this.Steps.TabIndex = 27;
this.Steps.Text = "25";
this.Steps.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
//
// Stepslbl
//
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.Name = "Stepslbl";
this.Stepslbl.Size = new System.Drawing.Size(37, 13);
@ -380,17 +413,19 @@
//
// 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.MaxLength = 4;
this.Cfg.Name = "Cfg";
this.Cfg.Size = new System.Drawing.Size(95, 20);
this.Cfg.TabIndex = 29;
this.Cfg.Text = "7.0";
this.Cfg.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Cfg_KeyPress);
//
// Cfglbl
//
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.Name = "Cfglbl";
this.Cfglbl.Size = new System.Drawing.Size(26, 13);
@ -399,17 +434,19 @@
//
// 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.MaxLength = 6;
this.Seed.Name = "Seed";
this.Seed.Size = new System.Drawing.Size(95, 20);
this.Seed.TabIndex = 31;
this.Seed.Text = "42";
this.Seed.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOnly);
//
// Seedlbl
//
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.Name = "Seedlbl";
this.Seedlbl.Size = new System.Drawing.Size(35, 13);
@ -419,7 +456,7 @@
// Schedulerlbl
//
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.Name = "Schedulerlbl";
this.Schedulerlbl.Size = new System.Drawing.Size(58, 13);
@ -434,17 +471,17 @@
"Euler",
"Euler A",
"DPM++",
"PNDM",
"DDIM"});
this.Scheduler.Location = new System.Drawing.Point(318, 470);
"PNDM"});
this.Scheduler.Location = new System.Drawing.Point(318, 480);
this.Scheduler.Margin = new System.Windows.Forms.Padding(2);
this.Scheduler.Name = "Scheduler";
this.Scheduler.Size = new System.Drawing.Size(138, 21);
this.Scheduler.TabIndex = 32;
this.Scheduler.Text = "DDIM";
//
// 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.Name = "GenerateButton";
this.GenerateButton.Size = new System.Drawing.Size(544, 30);
@ -456,7 +493,7 @@
// PlayVideo
//
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.Size = new System.Drawing.Size(544, 24);
this.PlayVideo.TabIndex = 35;
@ -501,7 +538,7 @@
//
// 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.Size = new System.Drawing.Size(228, 79);
this.RunJobs.TabIndex = 39;
@ -516,7 +553,7 @@
//
// 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.Size = new System.Drawing.Size(67, 21);
this.Batch.TabIndex = 40;
@ -526,6 +563,14 @@
//
// panel1
//
this.panel1.Controls.Add(this.Updates);
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.Schedulerlbl);
this.panel1.Controls.Add(this.Scheduler);
@ -562,14 +607,114 @@
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(6, 6);
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;
//
// 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",
"1920, 1080",
"1366, 768",
"1280, 720",
"1024, 768",
"768, 768",
"720, 540",
"854, 480",
"640, 360 ",
"512, 512"});
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);
//
// timer3
//
this.timer3.Interval = 5000;
this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
//
// Updates
//
this.Updates.AutoSize = true;
this.Updates.Location = new System.Drawing.Point(382, 449);
this.Updates.Name = "Updates";
this.Updates.Size = new System.Drawing.Size(150, 17);
this.Updates.TabIndex = 48;
this.Updates.Text = "Check For Model Updates";
this.Updates.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
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.RunJobs);
this.Controls.Add(this.RemoveJob);
@ -638,6 +783,15 @@
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Button Batch;
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;
private System.Windows.Forms.Timer timer3;
private System.Windows.Forms.CheckBox Updates;
}
}

View File

@ -1,9 +1,19 @@
using System;
/*
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
@ -16,48 +26,64 @@ namespace Ruyi_GUI
public partial class Form1 : Form
{
public static List<string> LogMessages = new List<string>();
public string PythonCode;
public string[] PythonCode;
public bool DoingJobs = false;
public bool Not100 = true;
public Form1()
{
InitializeComponent();
PythonCode = Encoding.UTF8.GetString(Convert.FromBase64String(Decompress(Convert.FromBase64String("xRprb+M28nuA/AeeroClrqrdpO0eEEAf0tjZGhdvgiS3/ZAzBMaibG5kUadHNmng/34zJCVRD9vpXoAL0CbivIfD4cxw+ToVWUFEfnjA1Z+FyBarw4MoE2tyNb0genm6pkuml0MeRWXOsrwC2pMyZtmY54uMFexmsWIhLrhErp8mC5YXGY37COOr2Y2IH1k2K+OC5wVLDeKrz+OZ8TkeT5tPR6si1mxJFyKJKlUuceEMFjQCyE3ySGRrQ92zi+mVtOcqE6BaLoA7rn3hORfJTIQs/oMXK4B+ZYsCljSvnEagfQL4uSfdVDGMBQ2DiMeM0Fx9GKiaeFUulzxZRnTBglV5X5HmCU3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BgPbedjdJCZByCDxz/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")); }
else
else { SaveSettings(); }
if(!File.Exists("environment.bat"))
{
FrameRate.SelectedIndex = 0;
AspectRatio.SelectedIndex = 0;
Resolution.SelectedIndex = 0;
Direction.SelectedIndex = 0;
Motion.SelectedIndex = 0;
Scheduler.SelectedIndex = 0;
SaveSettings();
MessageBox.Show("environment.bat file missing, Is this exe being ran from Forge Install folder?","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
if (!Directory.Exists("Ruyi-Models"))
{
MessageBox.Show("Missing Ruyi-Models Folder", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if(!File.Exists(Path.Combine("Ruyi-Models", "predict_i2v.py")))
{
MessageBox.Show("Missing predict_i2v.py", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
PythonCode = File.ReadAllLines(Path.Combine("Ruyi-Models", "predict_i2v.py"));
}
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 + "|" + Updates.Checked; }
private void SaveSettings() { File.WriteAllText("Config.cfg", SettingsString()); }
private void LoadSettings(string Settings)
{
try
{
string[] SSettings = Settings.Split('|');
Img1.Text = SSettings[0];
Img2.Text = SSettings[1];
VideoOut.Text = SSettings[2];
FrameRate.SelectedIndex = int.Parse(SSettings[3]);
AspectRatio.SelectedIndex = int.Parse(SSettings[4]);
Resolution.SelectedIndex = int.Parse(SSettings[5]);
Direction.SelectedIndex = int.Parse(SSettings[6]);
Motion.SelectedIndex = int.Parse(SSettings[7]);
FrameRate.Text = SSettings[3];
AspectRatio.Text = SSettings[4];
Resolution.Text = SSettings[5];
Direction.Text = SSettings[6];
Motion.Text = SSettings[7];
GPUOffload.Text = SSettings[8];
LowMemoryMode.Checked = bool.Parse(SSettings[9]);
Steps.Text = SSettings[10];
Cfg.Text = SSettings[11];
Seed.Text = SSettings[12];
Scheduler.SelectedIndex = int.Parse(SSettings[13]);
Scheduler.Text = SSettings[13];
VideoRes.Text = SSettings[14];
Loratxt.Text = SSettings[15];
Weighttxt.Text = SSettings[16];
Updates.Checked = bool.Parse(SSettings[17]);
}
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(Img2.Text)) { pictureBox2.BackgroundImage = new Bitmap(Img2.Text); }
else { pictureBox2.BackgroundImage = null; }
@ -102,16 +128,19 @@ namespace Ruyi_GUI
private void LogFiltered(string message)
{
if (string.IsNullOrEmpty(message)) { return; }
if (string.IsNullOrEmpty(message) || message.Contains(" attn_output = torch.nn.functional.scaled_dot_product_attention(")) { return; }
LogMessages.Add(message);
if (message.Contains("%")) { AppendTextBox(message); }
if (message.Contains("%") || message.StartsWith("Fetching ")) { AppendTextBox(message); }
if (message.StartsWith("Fetching ")) { return; }
if (message.Contains("100%") && Not100) { Not100 = false; return; }
if (message.Contains("100%"))
{
Not100 = true;
timer3.Enabled = false;
AppendTextBox("Saving Mp4...");
GenerateButton.BeginInvoke(new Action(() => { GenerateButton.Enabled = true; }));
panel1.BeginInvoke(new Action(() => { panel1.Enabled = true; }));
LogMessages.Add("Finished Generation @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
if (DoingJobs)
{
while (!File.Exists(VideoOut.Text)) { Thread.Sleep(1000); }
@ -142,17 +171,122 @@ namespace Ruyi_GUI
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 (string.IsNullOrEmpty(Img1.Text)) { MessageBox.Show("You Must Select A Input Image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
if (ValidateInOut())
{
if (this.Width == 810) { this.Width = 575; JobList.Items.Clear(); }
ExecuteCommand();
}
}
private string ParsePythonCode()
{
string code = "";
string Image2 = string.IsNullOrEmpty(Img2.Text) ? "None" : @"""" + Img2.Text.Replace(@"\", @"\\") + @"""";
string Lora = string.IsNullOrEmpty(Loratxt.Text) ? "None" : @"""" + Loratxt.Text.Replace(@"\", @"\\") + @"""";
foreach (string line in PythonCode)
{
if(line.StartsWith("start_image_path = "))
{
code += @"start_image_path = """ + Img1.Text.Replace(@"\", @"\\") + @""""+ System.Environment.NewLine;
continue;
}
if (line.StartsWith("end_image_path = "))
{
code += "end_image_path = " + Image2.Replace(@"\", @"\\") + System.Environment.NewLine;
continue;
}
if (line.StartsWith("output_video_path = "))
{
code += @"output_video_path = """ + VideoOut.Text.Replace(@"\", @"\\") + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("video_length = "))
{
code += @"video_length = " + FrameRate.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("base_resolution = "))
{
code += @"base_resolution = " + Resolution.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("video_size = "))
{
code += @"video_size = " + VideoRes.Text.Replace("auto","None") + System.Environment.NewLine;
continue;
}
if (line.StartsWith("aspect_ratio = "))
{
code += @"aspect_ratio = """ + AspectRatio.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("motion = "))
{
code += @"motion = """ + Motion.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("camera_direction = "))
{
code += @"camera_direction = """ + Direction.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("steps = "))
{
code += @"steps = " + Steps.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("cfg = "))
{
code += @"cfg = " + Cfg.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("scheduler_name = "))
{
code += @"scheduler_name = """ + Scheduler.Text + @"""" + System.Environment.NewLine;
continue;
}
if (line.StartsWith("low_gpu_memory_mode = "))
{
code += @"low_gpu_memory_mode = " + LowMemoryMode.Checked.ToString() + System.Environment.NewLine;
continue;
}
if (line.StartsWith("gpu_offload_steps = "))
{
code += @"gpu_offload_steps = " + GPUOffload.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("seed = "))
{
code += @"seed = " + Seed.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("lora_path = "))
{
code += @"lora_path = " + Lora + System.Environment.NewLine;
continue;
}
if (line.StartsWith("lora_weight = "))
{
code += @"lora_weight = " + Weighttxt.Text + System.Environment.NewLine;
continue;
}
if (line.StartsWith("auto_update = "))
{
code += @"auto_update = " + Updates.Checked.ToString() + System.Environment.NewLine;
continue;
}
code += line + System.Environment.NewLine;
}
return code;
}
private void ExecuteCommand()
{
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 CallCode = ParsePythonCode();
if (string.IsNullOrEmpty(CallCode)) { MessageBox.Show("Bad Python Code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
File.WriteAllText(Path.Combine("Ruyi-Models", "i2v.py"), CallCode);
if (File.Exists(VideoOut.Text)) { File.Move(VideoOut.Text, VideoOut.Text.Replace(".mp4", "-" + GetTimestamp() + ".mp4")); }
LogMessages.Add("Starting Generation: ["+FrameRate.Text + "-"+ Resolution.Text +"] " + Path.GetFileName(Img1.Text) + " @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
Task.Run(() =>
{
GenerateButton.BeginInvoke(new Action(() => { GenerateButton.Enabled = false; }));
@ -171,6 +305,7 @@ namespace Ruyi_GUI
process.WaitForExit();
process.Close();
});
timer3.Enabled = true;
}
private string SelectImageButton()
@ -236,7 +371,30 @@ 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") && !VideoRes.Text.Contains("auto")) { MessageBox.Show("Mp4 Resolution Not Valid Format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; }
return true;
}
private void AddJob_Click(object sender, EventArgs e)
{
if (ValidateInOut())
{
string Settings = SettingsString();
string Job = GetHashString(Settings);
@ -245,6 +403,7 @@ namespace Ruyi_GUI
File.WriteAllText(Path.Combine("Jobs", Job), Settings);
JobList.Items.Add(Job);
}
}
private void RemoveJob_Click(object sender, EventArgs e)
{
@ -301,9 +460,10 @@ namespace Ruyi_GUI
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
{
GenerateButton.Enabled = false;
if (Directory.Exists("Jobs"))
{
DirectoryInfo d = new DirectoryInfo("Jobs");
@ -322,5 +482,50 @@ namespace Ruyi_GUI
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();
}
private void timer3_Tick(object sender, EventArgs e)
{
Process[] processes = Process.GetProcesses();
bool isPythonRunning = processes.Any(p => p.ProcessName.Equals("python", StringComparison.OrdinalIgnoreCase));
if (!isPythonRunning)
{
timer3.Enabled = false;
MessageBox.Show("python.exe is not running. Maybe it crashed, Please check the log.txt","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
}

View File

@ -123,6 +123,9 @@
<metadata name="timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>105, 17</value>
</metadata>
<metadata name="timer3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>193, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

Binary file not shown.