mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
Improve validation for Whisper English only models - thx Purfview :)
This commit is contained in:
parent
6a9c8465bc
commit
7e362d1d95
@ -387,7 +387,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
_languageCode = GetLanguage(comboBoxLanguages.Text);
|
||||
|
||||
if (comboBoxModels.Items[comboBoxModels.SelectedIndex] is WhisperModel model &&
|
||||
_languageCode != "en" && model.Name.EndsWith(".en", StringComparison.InvariantCulture))
|
||||
_languageCode != "en" && IsModelEnglishOnly(model))
|
||||
{
|
||||
var result = MessageBox.Show("English model should only be used with English language." + Environment.NewLine +
|
||||
"Continue anyway?", Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
|
||||
@ -514,6 +514,13 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private static bool IsModelEnglishOnly(WhisperModel model)
|
||||
{
|
||||
return model.Name.EndsWith(".en", StringComparison.InvariantCulture) ||
|
||||
model.Name == "distil-large-v2" ||
|
||||
model.Name == "distil-large-v3";
|
||||
}
|
||||
|
||||
private void ShowProgressBar()
|
||||
{
|
||||
progressBar1.Maximum = 100;
|
||||
|
Loading…
Reference in New Issue
Block a user