From b0272c455e97302420309cecd902975023b133ac Mon Sep 17 00:00:00 2001
From: Jaap <33700526+GewoonJaap@users.noreply.github.com>
Date: Sat, 12 Oct 2024 11:09:55 +0200
Subject: [PATCH] WinWhisper update
---
ConsoleApp/ConsoleApp.csproj | 4 ++--
ConsoleApp/Program.cs | 1 +
Data/Enum/WinWhisperModelType.cs | 3 ++-
Utility/ConsoleUtil.cs | 8 +++++---
Utility/ModelNameFetcher.cs | 14 +++++++++++++-
Utility/Utility.csproj | 4 ++--
WhisperAI/WhisperAI.csproj | 4 ++--
7 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/ConsoleApp/ConsoleApp.csproj b/ConsoleApp/ConsoleApp.csproj
index 4a2c1a0..d6d6860 100644
--- a/ConsoleApp/ConsoleApp.csproj
+++ b/ConsoleApp/ConsoleApp.csproj
@@ -8,7 +8,7 @@
WinWhisper
WinWhisper-White_Icon.ico
AnyCPU;ARM64
- 1.4.0
+ 1.4.1
WinWhisper is a Windows application that uses AI to detect and remove background noise from audio files.
Jaap
True
@@ -21,7 +21,7 @@
-
+
diff --git a/ConsoleApp/Program.cs b/ConsoleApp/Program.cs
index ce6dfc8..9bad6aa 100644
--- a/ConsoleApp/Program.cs
+++ b/ConsoleApp/Program.cs
@@ -110,6 +110,7 @@ private static GatherVideoResult GatherVideosToConvert()
//if path starts and ends with ", remove
inputPath = PathUtil.FormatPath(inputPath);
var modelType = ConsoleUtil.AskForModelType();
+ Console.WriteLine($"Selected model: {modelType}");
var videos = VideoFinder.FindVideosBasedOnPath(inputPath);
return new GatherVideoResult(videos, subtitleOutputPath, modelType);
diff --git a/Data/Enum/WinWhisperModelType.cs b/Data/Enum/WinWhisperModelType.cs
index 8eab154..0d920bc 100644
--- a/Data/Enum/WinWhisperModelType.cs
+++ b/Data/Enum/WinWhisperModelType.cs
@@ -18,6 +18,7 @@ public enum WinWhisperModelType
Small,
SmallEn,
Tiny,
- TinyEn
+ TinyEn,
+ LargeV3Turbo
}
}
diff --git a/Utility/ConsoleUtil.cs b/Utility/ConsoleUtil.cs
index a39b301..5507ab6 100644
--- a/Utility/ConsoleUtil.cs
+++ b/Utility/ConsoleUtil.cs
@@ -5,7 +5,7 @@ namespace Utility;
public static class ConsoleUtil
{
- private const string DEFAULT_MODEL_TYPE = "base";
+ private const string DEFAULT_MODEL_TYPE = "large-v3-turbo";
public static string AskForLanguageCode(string fileName)
{
Console.WriteLine($"In which language code (en,nl etc) is the audio for video: {fileName}? Leave empty to auto detect");
@@ -19,7 +19,9 @@ public static string AskForLanguageCode(string fileName)
public static WinWhisperModelType AskForModelType()
{
- Console.WriteLine("Which model type do you want to use? (base, base-en, large-v2, large-v1, large-v3, medium, medium-en, small, small-en, tiny, tiny-en)");
+ var modelTypes = ModelNameFetcher.GetModelTypes();
+ var modelTypesText = string.Join(", ", modelTypes);
+ Console.WriteLine($"Which model type do you want to use? ({modelTypesText})");
Console.WriteLine($"Default: {DEFAULT_MODEL_TYPE}");
var modelType = Console.ReadLine() ?? DEFAULT_MODEL_TYPE;
if(modelType.Trim().Length == 0)
@@ -28,7 +30,7 @@ public static WinWhisperModelType AskForModelType()
}
try
{
- return ModelNameFetcher.StringToModelType(modelType.ToLower());
+ return ModelNameFetcher.StringToModelType(modelType);
}
catch
{
diff --git a/Utility/ModelNameFetcher.cs b/Utility/ModelNameFetcher.cs
index 3b48dec..f26cd0e 100644
--- a/Utility/ModelNameFetcher.cs
+++ b/Utility/ModelNameFetcher.cs
@@ -21,6 +21,7 @@ public static string GgmlTypeToString(GgmlType modelType)
GgmlType.SmallEn => "small-en",
GgmlType.Tiny => "tiny",
GgmlType.TinyEn => "tiny-en",
+ GgmlType.LargeV3Turbo => "large-v3-turbo",
_ => throw new WinWhisperModelNotFoundException(modelType.ToString())
};
@@ -29,7 +30,11 @@ public static string GgmlTypeToString(GgmlType modelType)
public static WinWhisperModelType StringToModelType(string modelType)
{
- return modelType switch
+ if (Enum.TryParse(modelType, true, out var result))
+ {
+ return result;
+ }
+ return modelType.ToLower() switch
{
"base" => WinWhisperModelType.Base,
"base-en" => WinWhisperModelType.BaseEn,
@@ -42,6 +47,7 @@ public static WinWhisperModelType StringToModelType(string modelType)
"small-en" => WinWhisperModelType.SmallEn,
"tiny" => WinWhisperModelType.Tiny,
"tiny-en" => WinWhisperModelType.TinyEn,
+ "large-v3-turbo" => WinWhisperModelType.LargeV3Turbo,
_ => throw new WinWhisperModelNotFoundException(modelType)
};
}
@@ -61,7 +67,13 @@ public static GgmlType ModelTypeToGgmlType(WinWhisperModelType modelType)
WinWhisperModelType.SmallEn => GgmlType.SmallEn,
WinWhisperModelType.Tiny => GgmlType.Tiny,
WinWhisperModelType.TinyEn => GgmlType.TinyEn,
+ WinWhisperModelType.LargeV3Turbo => GgmlType.LargeV3Turbo,
_ => throw new WinWhisperModelNotFoundException(modelType.ToString())
};
}
+
+ public static List GetModelTypes()
+ {
+ return Enum.GetValues(typeof(WinWhisperModelType)).Cast().Select(x => x.ToString()).ToList();
+ }
}
\ No newline at end of file
diff --git a/Utility/Utility.csproj b/Utility/Utility.csproj
index 8dfb611..e078711 100644
--- a/Utility/Utility.csproj
+++ b/Utility/Utility.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/WhisperAI/WhisperAI.csproj b/WhisperAI/WhisperAI.csproj
index f100cf8..04078af 100644
--- a/WhisperAI/WhisperAI.csproj
+++ b/WhisperAI/WhisperAI.csproj
@@ -8,8 +8,8 @@
-
-
+
+