Minor improve of Whisper UI

This commit is contained in:
niksedk 2023-08-16 10:55:41 +02:00
parent ec8f8584c8
commit 57879a61dc
6 changed files with 53 additions and 11 deletions

View File

@ -98,6 +98,7 @@
<Collapse>Collapse</Collapse>
<ShortcutX>Shortcut: {0}</ShortcutX>
<ExampleX>Example: {0}</ExampleX>
<ViewX>View {0}</ViewX>
<Reset>Reset</Reset>
<Error>Error</Error>
<Warning>Warning</Warning>
@ -204,6 +205,7 @@ Read more info (web)?</WhisperNotFound>
<LoadingVoskModel>Loading Vosk speech recognition model...</LoadingVoskModel>
<Transcribing>Transcribing audio to text...</Transcribing>
<TranscribingXOfY>Transcribing audio to text - file {0} of {1}...</TranscribingXOfY>
<PostProcessing>Post-processing...</PostProcessing>
<XFilesSavedToVideoSourceFolder>{0} files saved to video source folder</XFilesSavedToVideoSourceFolder>
<UsePostProcessing>Use post-processing (line merge, fix casing, punctuation, and more)</UsePostProcessing>
<AutoAdjustTimings>Auto adjust timings</AutoAdjustTimings>

View File

@ -62,12 +62,12 @@
this.setCPPConstmeModelsFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeTemporaryFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showWhisperlogtxtToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.checkBoxAutoAdjustTimings = new System.Windows.Forms.CheckBox();
this.comboBoxWhisperEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.labelEngine = new System.Windows.Forms.Label();
this.buttonAdvanced = new System.Windows.Forms.Button();
this.labelAdvanced = new System.Windows.Forms.Label();
this.showWhisperlogtxtToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBoxModels.SuspendLayout();
this.groupBoxInputFiles.SuspendLayout();
this.contextMenuStripWhisperAdvanced.SuspendLayout();
@ -404,7 +404,7 @@
this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem,
this.showWhisperlogtxtToolStripMenuItem});
this.contextMenuStripWhisperAdvanced.Name = "contextMenuStripWhisperAdvanced";
this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(320, 142);
this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(320, 120);
this.contextMenuStripWhisperAdvanced.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripWhisperAdvanced_Opening);
//
// runOnlyPostProcessingToolStripMenuItem
@ -440,6 +440,13 @@
this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Text = "Download CUDA for Perfview\'s Whisper-Faster";
this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Click += new System.EventHandler(this.downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem_Click);
//
// showWhisperlogtxtToolStripMenuItem
//
this.showWhisperlogtxtToolStripMenuItem.Name = "showWhisperlogtxtToolStripMenuItem";
this.showWhisperlogtxtToolStripMenuItem.Size = new System.Drawing.Size(319, 22);
this.showWhisperlogtxtToolStripMenuItem.Text = "Show whisper_log.txt";
this.showWhisperlogtxtToolStripMenuItem.Click += new System.EventHandler(this.ShowWhisperLogFileToolStripMenuItem_Click);
//
// checkBoxAutoAdjustTimings
//
this.checkBoxAutoAdjustTimings.AutoSize = true;
@ -505,13 +512,6 @@
this.labelAdvanced.TabIndex = 29;
this.labelAdvanced.Text = "Advanced...";
//
// showWhisperlogtxtToolStripMenuItem
//
this.showWhisperlogtxtToolStripMenuItem.Name = "showWhisperlogtxtToolStripMenuItem";
this.showWhisperlogtxtToolStripMenuItem.Size = new System.Drawing.Size(319, 22);
this.showWhisperlogtxtToolStripMenuItem.Text = "Show whisper_log.txt";
this.showWhisperlogtxtToolStripMenuItem.Click += new System.EventHandler(this.ShowWhisperLogFileToolStripMenuItem_Click);
//
// WhisperAudioToText
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -315,6 +315,22 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
return;
}
timer1.Start();
if (_showProgressPct > 0 && progressBar1.Style == ProgressBarStyle.Blocks)
{
_showProgressPct = 100;
progressBar1.Value = progressBar1.Maximum;
}
if (checkBoxAutoAdjustTimings.Checked || checkBoxUsePostProcessing.Checked)
{
labelProgress.Text = LanguageSettings.Current.AudioToText.PostProcessing;
}
labelTime.Text = string.Empty;
labelProgress.Refresh();
Application.DoEvents();
var postProcessor = new AudioToTextPostProcessor(_languageCode)
{
ParagraphMaxChars = Configuration.Settings.General.SubtitleLineMaximumLength * 2,
@ -346,6 +362,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
SeLogger.WhisperInfo(textBoxLog.Text);
}
timer1.Stop();
DialogResult = DialogResult.OK;
}
@ -1275,7 +1293,10 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
buttonGenerate.Focus();
_initialWidth = Width;
CheckIfInstalledAndVersion(Configuration.Settings.Tools.WhisperChoice);
System.Threading.SynchronizationContext.Current.Post(TimeSpan.FromMilliseconds(25), () =>
{
CheckIfInstalledAndVersion(Configuration.Settings.Tools.WhisperChoice);
});
}
private void CheckIfInstalledAndVersion(string whisperChoice)
@ -1744,7 +1765,16 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
downloadCUDAForPerfviewsWhisperFasterToolStripMenuItem.Visible = Configuration.Settings.Tools.WhisperChoice == WhisperChoice.PurfviewFasterWhisper;
showWhisperlogtxtToolStripMenuItem.Visible = File.Exists(SeLogger.GetWhisperLogFilePath());
var whisperLogFile = SeLogger.GetWhisperLogFilePath();
if (File.Exists(whisperLogFile))
{
showWhisperlogtxtToolStripMenuItem.Visible = true;
showWhisperlogtxtToolStripMenuItem.Text = string.Format(LanguageSettings.Current.General.ViewX, $"\"{Path.GetFileName(whisperLogFile)}\"");
}
else
{
showWhisperlogtxtToolStripMenuItem.Visible = false;
}
}
private void runOnlyPostProcessingToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -234,6 +234,7 @@ namespace Nikse.SubtitleEdit.Logic
Collapse = "Collapse",
ShortcutX = "Shortcut: {0}",
ExampleX = "Example: {0}",
ViewX = "View {0}",
Reset = "Reset",
Error = "Error",
Warning = "Warning",
@ -356,6 +357,7 @@ namespace Nikse.SubtitleEdit.Logic
LoadingVoskModel = "Loading Vosk speech recognition model...",
Transcribing = "Transcribing audio to text...",
TranscribingXOfY = "Transcribing audio to text - file {0} of {1}...",
PostProcessing = "Post-processing...",
UsePostProcessing = "Use post-processing (line merge, fix casing, punctuation, and more)",
AutoAdjustTimings = "Auto adjust timings",
BatchMode = "Batch mode",

View File

@ -349,6 +349,9 @@ namespace Nikse.SubtitleEdit.Logic
case "General/ExampleX":
language.General.ExampleX = reader.Value;
break;
case "General/ViewX":
language.General.ViewX = reader.Value;
break;
case "General/Reset":
language.General.Reset = reader.Value;
break;
@ -553,6 +556,9 @@ namespace Nikse.SubtitleEdit.Logic
case "AudioToText/TranscribingXOfY":
language.AudioToText.TranscribingXOfY = reader.Value;
break;
case "AudioToText/PostProcessing":
language.AudioToText.PostProcessing = reader.Value;
break;
case "AudioToText/XFilesSavedToVideoSourceFolder":
language.AudioToText.XFilesSavedToVideoSourceFolder = reader.Value;
break;

View File

@ -102,6 +102,7 @@
public string Collapse { get; set; }
public string ShortcutX { get; set; }
public string ExampleX { get; set; }
public string ViewX { get; set; }
public string Reset { get; set; }
public string Error { get; set; }
public string Warning { get; set; }
@ -206,6 +207,7 @@
public string LoadingVoskModel { get; set; }
public string Transcribing { get; set; }
public string TranscribingXOfY { get; set; }
public string PostProcessing { get; set; }
public string XFilesSavedToVideoSourceFolder { get; set; }
public string UsePostProcessing { get; set; }
public string AutoAdjustTimings { get; set; }