コード例 #1
0
        public static void Cancel(string reason = "", bool noMsgBox = false)
        {
            canceled = true;
            Program.mainForm.SetStatus("Canceled.");
            Program.mainForm.SetProgress(0);
            AiProcess.Kill();
            AvProcess.Kill();

            if (!current.stepByStep && !Config.GetBool("keepTempFolder"))
            {
                if (false /* IOUtils.GetAmountOfFiles(Path.Combine(current.tempFolder, Paths.resumeDir), true) > 0 */)   // TODO: Uncomment for 1.23
                {
                    DialogResult dialogResult = MessageBox.Show($"Delete the temp folder (Yes) or keep it for resuming later (No)?", "Delete temporary files?", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        IOUtils.TryDeleteIfExists(current.tempFolder);
                    }
                }
                else
                {
                    IOUtils.TryDeleteIfExists(current.tempFolder);
                }
            }

            AutoEncode.busy = false;
            Program.mainForm.SetWorking(false);
            Program.mainForm.SetTab("interpolation");
            Logger.LogIfLastLineDoesNotContainMsg("Canceled interpolation.");

            if (!string.IsNullOrWhiteSpace(reason) && !noMsgBox)
            {
                Utils.ShowMessage($"Canceled:\n\n{reason}");
            }
        }
コード例 #2
0
        public static async Task RunAi(string outpath, AI ai, bool stepByStep = false)
        {
            Program.mainForm.SetStatus("Downloading models...");
            await ModelDownloader.DownloadModelFiles(ai.pkgDir, current.model);

            if (canceled)
            {
                return;
            }

            currentlyUsingAutoEnc = Utils.CanUseAutoEnc(stepByStep, current);

            IOUtils.CreateDir(outpath);

            List <Task> tasks = new List <Task>();

            if (ai.aiName == Networks.rifeCuda.aiName)
            {
                tasks.Add(AiProcess.RunRifeCuda(current.framesFolder, current.interpFactor, current.model));
            }

            if (ai.aiName == Networks.rifeNcnn.aiName)
            {
                tasks.Add(AiProcess.RunRifeNcnn(current.framesFolder, outpath, (int)current.interpFactor, current.model));
            }

            if (ai.aiName == Networks.flavrCuda.aiName)
            {
                tasks.Add(AiProcess.RunFlavrCuda(current.framesFolder, current.interpFactor, current.model));
            }

            if (ai.aiName == Networks.dainNcnn.aiName)
            {
                tasks.Add(AiProcess.RunDainNcnn(current.framesFolder, outpath, current.interpFactor, current.model, Config.GetInt("dainNcnnTilesize", 512)));
            }

            if (currentlyUsingAutoEnc)
            {
                Logger.Log($"{Logger.GetLastLine()} (Using Auto-Encode)", true);
                tasks.Add(AutoEncode.MainLoop(outpath));
            }

            Program.mainForm.SetStatus("Running AI...");
            await Task.WhenAll(tasks);
        }
コード例 #3
0
ファイル: Interpolate.cs プロジェクト: n00mkrad/flowframes
        public static void Cancel(string reason = "", bool noMsgBox = false)
        {
            if (current == null)
            {
                return;
            }

            canceled = true;
            Program.mainForm.SetStatus("Canceled.");
            Program.mainForm.SetProgress(0);
            AiProcess.Kill();
            AvProcess.Kill();

            if (!current.stepByStep && !Config.GetBool(Config.Key.keepTempFolder))
            {
                if (!BatchProcessing.busy && IoUtils.GetAmountOfFiles(Path.Combine(current.tempFolder, Paths.resumeDir), true) > 0)
                {
                    DialogResult dialogResult = MessageBox.Show($"Delete the temp folder (Yes) or keep it for resuming later (No)?", "Delete temporary files?", MessageBoxButtons.YesNo);

                    if (dialogResult == DialogResult.Yes)
                    {
                        Task.Run(async() => { await IoUtils.TryDeleteIfExistsAsync(current.tempFolder); });
                    }
                }
                else
                {
                    Task.Run(async() => { await IoUtils.TryDeleteIfExistsAsync(current.tempFolder); });
                }
            }

            AutoEncode.busy = false;
            Program.mainForm.SetWorking(false);
            Program.mainForm.SetTab("interpolation");
            Logger.LogIfLastLineDoesNotContainMsg("Canceled interpolation.");

            if (!string.IsNullOrWhiteSpace(reason) && !noMsgBox)
            {
                UiUtils.ShowMessageBox($"Canceled:\n\n{reason}");
            }
        }
コード例 #4
0
ファイル: Interpolate.cs プロジェクト: n00mkrad/flowframes
        public static async Task RunAi(string outpath, AI ai, bool stepByStep = false)
        {
            if (canceled)
            {
                return;
            }

            await Task.Run(async() => { await Dedupe.CreateDupesFile(current.framesFolder, currentInputFrameCount, current.framesExt); });

            await Task.Run(async() => { await FrameRename.Rename(); });

            await Task.Run(async() => { await FrameOrder.CreateFrameOrderFile(current.framesFolder, Config.GetBool(Config.Key.enableLoop), current.interpFactor); });

            Program.mainForm.SetStatus("Downloading models...");
            await ModelDownloader.DownloadModelFiles(ai, current.model.dir);

            if (canceled)
            {
                return;
            }

            currentlyUsingAutoEnc = Utils.CanUseAutoEnc(stepByStep, current);

            IoUtils.CreateDir(outpath);

            List <Task> tasks = new List <Task>();

            if (ai.aiName == Implementations.rifeCuda.aiName)
            {
                tasks.Add(AiProcess.RunRifeCuda(current.framesFolder, current.interpFactor, current.model.dir));
            }

            if (ai.aiName == Implementations.rifeNcnn.aiName)
            {
                tasks.Add(AiProcess.RunRifeNcnn(current.framesFolder, outpath, current.interpFactor, current.model.dir));
            }

            if (ai.aiName == Implementations.flavrCuda.aiName)
            {
                tasks.Add(AiProcess.RunFlavrCuda(current.framesFolder, current.interpFactor, current.model.dir));
            }

            if (ai.aiName == Implementations.dainNcnn.aiName)
            {
                tasks.Add(AiProcess.RunDainNcnn(current.framesFolder, outpath, current.interpFactor, current.model.dir, Config.GetInt(Config.Key.dainNcnnTilesize, 512)));
            }

            if (ai.aiName == Implementations.xvfiCuda.aiName)
            {
                tasks.Add(AiProcess.RunXvfiCuda(current.framesFolder, current.interpFactor, current.model.dir));
            }

            if (currentlyUsingAutoEnc)
            {
                Logger.Log($"{Logger.GetLastLine()} (Using Auto-Encode)", true);
                tasks.Add(AutoEncode.MainLoop(outpath));
            }

            Program.mainForm.SetStatus("Running AI...");
            await Task.WhenAll(tasks);
        }