diff --git a/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx b/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx
index 961c7f43..b8c0e604 100644
--- a/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx
+++ b/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx
@@ -10,11 +10,15 @@ import {
useSpeakerRecordTimeout,
useSpeakerPhraseTimeout,
useSpeakerMaxWords,
+
+ useWhisperWeightTypeStatus,
+ useSelectedWhisperWeightType,
} from "@logics_configs";
import {
EntryContainer,
WordFilterContainer,
+ DownloadModelsContainer,
} from "../_templates/Templates";
export const Transcription = () => {
@@ -22,6 +26,7 @@ export const Transcription = () => {
<>
+
>
);
};
@@ -225,3 +230,40 @@ const SpeakerMaxWords_Box = () => {
/>
);
};
+
+
+const WhisperWeightType_Box = () => {
+ const { t } = useTranslation();
+ const {
+ currentWhisperWeightTypeStatus,
+ pendingWhisperWeightType,
+ downloadWhisperWeight,
+ } = useWhisperWeightTypeStatus();
+ const { currentSelectedWhisperWeightType, setSelectedWhisperWeightType } = useSelectedWhisperWeightType();
+
+ const selectFunction = (id) => {
+ setSelectedWhisperWeightType(id);
+ };
+
+ const downloadStartFunction = (id) => {
+ pendingWhisperWeightType(id);
+ downloadWhisperWeight(id);
+ };
+
+ return (
+ <>
+
+ >
+ );
+};
\ No newline at end of file
diff --git a/src-ui/logics/configs/index.js b/src-ui/logics/configs/index.js
index 6f646d5e..4a3399ee 100644
--- a/src-ui/logics/configs/index.js
+++ b/src-ui/logics/configs/index.js
@@ -31,8 +31,11 @@ export { useSpeakerRecordTimeout } from "./transcription/useSpeakerRecordTimeout
export { useSpeakerPhraseTimeout } from "./transcription/useSpeakerPhraseTimeout";
export { useSpeakerMaxWords } from "./transcription/useSpeakerMaxWords";
-export { useCTranslate2WeightTypeStatus } from "./translation/useCTranslate2WeightTypeStatus";
+export { useWhisperWeightTypeStatus } from "./transcription/useWhisperWeightTypeStatus";
+export { useSelectedWhisperWeightType } from "./transcription/useSelectedWhisperWeightType";
+
export { useDeepLAuthKey } from "./translation/useDeepLAuthKey";
+export { useCTranslate2WeightTypeStatus } from "./translation/useCTranslate2WeightTypeStatus";
export { useSelectedCTranslate2WeightType } from "./translation/useSelectedCTranslate2WeightType";
export { useIsEnabledOverlaySmallLog } from "./vr/useIsEnabledOverlaySmallLog";
diff --git a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js b/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js
new file mode 100644
index 00000000..02993646
--- /dev/null
+++ b/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js
@@ -0,0 +1,24 @@
+import { useStore_SelectedWhisperWeightType } from "@store";
+import { useStdoutToPython } from "@logics/useStdoutToPython";
+
+export const useSelectedWhisperWeightType = () => {
+ const { asyncStdoutToPython } = useStdoutToPython();
+ const { currentSelectedWhisperWeightType, updateSelectedWhisperWeightType, pendingSelectedWhisperWeightType } = useStore_SelectedWhisperWeightType();
+
+ const getSelectedWhisperWeightType = () => {
+ pendingSelectedWhisperWeightType();
+ asyncStdoutToPython("/get/data/whisper_weight_type");
+ };
+
+ const setSelectedWhisperWeightType = (selected_whisper_weight_type) => {
+ pendingSelectedWhisperWeightType();
+ asyncStdoutToPython("/set/data/whisper_weight_type", selected_whisper_weight_type);
+ };
+
+ return {
+ currentSelectedWhisperWeightType,
+ getSelectedWhisperWeightType,
+ updateSelectedWhisperWeightType,
+ setSelectedWhisperWeightType,
+ };
+};
\ No newline at end of file
diff --git a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js b/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js
new file mode 100644
index 00000000..482273d2
--- /dev/null
+++ b/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js
@@ -0,0 +1,60 @@
+import { useStore_WhisperWeightTypeStatus } from "@store";
+import { useStdoutToPython } from "@logics/useStdoutToPython";
+
+export const useWhisperWeightTypeStatus = () => {
+ const { asyncStdoutToPython } = useStdoutToPython();
+ const { currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, pendingWhisperWeightTypeStatus } = useStore_WhisperWeightTypeStatus();
+
+ const updateDownloadedWhisperWeightTypeStatus = (downloaded_weight_type_status) => {
+ updateWhisperWeightTypeStatus((old_status) =>
+ old_status.data.map((item) => ({
+ ...item,
+ is_downloaded: downloaded_weight_type_status[item.id] ?? item.is_downloaded,
+ }))
+ );
+ };
+ const updateDownloadProgressWhisperWeightTypeStatus = (payload) => {
+ if (payload === true) return console.error("fix me.");
+
+ updateWhisperWeightTypeStatus((old_status) =>
+ old_status.data.map((item) =>
+ payload.weight_type === item.id
+ ? { ...item, progress: payload.progress * 100 }
+ : item
+ )
+ );
+ };
+ const pendingWhisperWeightType = (id) => {
+ updateWhisperWeightTypeStatus((old_status) =>
+ old_status.data.map((item) =>
+ id === item.id
+ ? { ...item, is_pending: true }
+ : item
+ )
+ );
+ };
+ const downloadedWhisperWeightType = (id) => {
+ updateWhisperWeightTypeStatus((old_status) =>
+ old_status.data.map((item) =>
+ id === item.id
+ ? { ...item, is_downloaded: true, is_pending: false, progress: null }
+ : item
+ )
+ );
+ };
+
+ const downloadWhisperWeight = (weight_type) => {
+ asyncStdoutToPython("/run/download_whisper_weight", weight_type);
+ };
+
+ return {
+ currentWhisperWeightTypeStatus,
+ updateWhisperWeightTypeStatus,
+
+ updateDownloadedWhisperWeightTypeStatus,
+ updateDownloadProgressWhisperWeightTypeStatus,
+ pendingWhisperWeightType,
+ downloadedWhisperWeightType,
+ downloadWhisperWeight,
+ };
+};
\ No newline at end of file
diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js
index 95a41b44..bb8e08cf 100644
--- a/src-ui/logics/useReceiveRoutes.js
+++ b/src-ui/logics/useReceiveRoutes.js
@@ -48,6 +48,8 @@ import {
useDeepLAuthKey,
useCTranslate2WeightTypeStatus,
useSelectedCTranslate2WeightType,
+ useSelectedWhisperWeightType,
+ useWhisperWeightTypeStatus,
useOverlaySettings,
useIsEnabledOverlaySmallLog,
useOverlaySmallLogSettings,
@@ -127,6 +129,13 @@ export const useReceiveRoutes = () => {
downloadedCTranslate2WeightType,
} = useCTranslate2WeightTypeStatus();
+ const { updateSelectedWhisperWeightType } = useSelectedWhisperWeightType();
+ const {
+ updateDownloadedWhisperWeightTypeStatus,
+ updateDownloadProgressWhisperWeightTypeStatus,
+ downloadedWhisperWeightType,
+ } = useWhisperWeightTypeStatus();
+
const { updateOverlaySettings } = useOverlaySettings();
const { updateOverlaySmallLogSettings } = useOverlaySmallLogSettings();
const { updateIsEnabledOverlaySmallLog } = useIsEnabledOverlaySmallLog();
@@ -342,6 +351,14 @@ export const useReceiveRoutes = () => {
"/get/data/speaker_max_phrases": updateSpeakerMaxWords,
"/set/data/speaker_max_phrases": updateSpeakerMaxWords,
+ "/get/data/whisper_weight_type": updateSelectedWhisperWeightType,
+ "/set/data/whisper_weight_type": updateSelectedWhisperWeightType,
+
+ "/get/data/selectable_whisper_weight_type_dict": updateDownloadedWhisperWeightTypeStatus,
+
+ "/run/download_whisper_weight": updateDownloadProgressWhisperWeightTypeStatus,
+ "/run/downloaded_whisper_weight": downloadedWhisperWeightType,
+
// VR
"/get/data/overlay_settings": updateOverlaySettings,
"/set/data/overlay_settings": updateOverlaySettings,
diff --git a/src-ui/store.js b/src-ui/store.js
index 13b6ead4..84d364f3 100644
--- a/src-ui/store.js
+++ b/src-ui/store.js
@@ -10,6 +10,7 @@ import {
import {
translator_status,
ctranslate2_weight_type_status,
+ whisper_weight_type_status,
} from "@ui_configs";
export const store = {
@@ -198,6 +199,10 @@ export const { atomInstance: Atom_SpeakerRecordTimeout, useHook: useStore_Speake
export const { atomInstance: Atom_SpeakerPhraseTimeout, useHook: useStore_SpeakerPhraseTimeout } = createAtomWithHook(0, "SpeakerPhraseTimeout");
export const { atomInstance: Atom_SpeakerMaxWords, useHook: useStore_SpeakerMaxWords } = createAtomWithHook(0, "SpeakerMaxWords");
+export const { atomInstance: Atom_SelectedWhisperWeightType, useHook: useStore_SelectedWhisperWeightType } = createAtomWithHook("", "SelectedWhisperWeightType");
+export const { atomInstance: Atom_WhisperWeightTypeStatus, useHook: useStore_WhisperWeightTypeStatus } = createAtomWithHook(whisper_weight_type_status, "WhisperWeightTypeStatus");
+
+
// VR
export const { atomInstance: Atom_OverlaySettings, useHook: useStore_OverlaySettings } = createAtomWithHook({
opacity: 1.0,
diff --git a/src-ui/ui_configs.js b/src-ui/ui_configs.js
index 1888964b..c232505d 100644
--- a/src-ui/ui_configs.js
+++ b/src-ui/ui_configs.js
@@ -23,4 +23,14 @@ export const ui_configs = {
export const ctranslate2_weight_type_status = [
{ id: "small", label: "small", is_downloaded: false, progress: null },
{ id: "large", label: "large", is_downloaded: false, progress: null },
+];
+
+export const whisper_weight_type_status = [
+ { id: "tiny", label: "tiny", is_downloaded: false, progress: null },
+ { id: "base", label: "base", is_downloaded: false, progress: null },
+ { id: "small", label: "small", is_downloaded: false, progress: null },
+ { id: "medium", label: "medium", is_downloaded: false, progress: null },
+ { id: "large-v1", label: "large-v1", is_downloaded: false, progress: null },
+ { id: "large-v2", label: "large-v2", is_downloaded: false, progress: null },
+ { id: "large-v3", label: "large-v3", is_downloaded: false, progress: null },
];
\ No newline at end of file