Add more validation

This commit is contained in:
Nikolaj Olsson 2024-04-17 18:09:32 +02:00
parent 6f424cc74a
commit d6f56a0aec

View File

@ -397,6 +397,18 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
}
}
if (comboBoxModels.Items[comboBoxModels.SelectedIndex] is WhisperModel model2 &&
_languageCode != "no" && _languageCode != "nb" && IsModelNorwegianOnly(model2))
{
var result = MessageBox.Show("Norwegian model should only be used with Norwegian language." + Environment.NewLine +
"Continue anyway?", Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
if (result != DialogResult.Yes)
{
return;
}
}
try
{
var f = SeLogger.GetWhisperLogFilePath();
@ -521,6 +533,11 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
model.Name == "distil-large-v3";
}
private static bool IsModelNorwegianOnly(WhisperModel model)
{
return model.ToString().Contains("Norwegian", StringComparison.OrdinalIgnoreCase);
}
private void ShowProgressBar()
{
progressBar1.Maximum = 100;