diff --git a/packages/components/src/api/tts/GetTtsModel.ts b/packages/components/src/api/tts/GetTtsModel.ts index 7c5049b76a..3b06ff4237 100644 --- a/packages/components/src/api/tts/GetTtsModel.ts +++ b/packages/components/src/api/tts/GetTtsModel.ts @@ -4,6 +4,8 @@ export interface TtsModel { model_token: string, title: string, tts_model_type: string, + text_pipeline_type: string | null, + text_pipeline_type_guess: string, maybe_default_pretrained_vocoder: string | null, text_preprocessing_algorithm: string, creator_user_token: string, diff --git a/packages/components/src/constants/TextPipeline.ts b/packages/components/src/constants/TextPipeline.ts new file mode 100644 index 0000000000..9a038e53ff --- /dev/null +++ b/packages/components/src/constants/TextPipeline.ts @@ -0,0 +1,11 @@ + +// Friendly names for each of the text pipeline identifiers. +const TEXT_PIPELINE_NAMES : Map = new Map([ + //["legacy_vocodes", "Legacy Vocodes"], + ["legacy_fakeyou", "Legacy FakeYou (grapheme-focused)"], + ["english_v1", "English v1 (Arpabet)"], + //["spanish_v1", "Spanish v1"], + //["spanish_v2", "Spanish v2"], +]); + +export { TEXT_PIPELINE_NAMES } \ No newline at end of file diff --git a/packages/fakeyou/src/v2/view/tts/tts_model_edit/TtsModelEditFc.tsx b/packages/fakeyou/src/v2/view/tts/tts_model_edit/TtsModelEditFc.tsx index 0a7150332a..1d9f486d08 100644 --- a/packages/fakeyou/src/v2/view/tts/tts_model_edit/TtsModelEditFc.tsx +++ b/packages/fakeyou/src/v2/view/tts/tts_model_edit/TtsModelEditFc.tsx @@ -12,6 +12,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faHeadphones, faHome, faRobot } from '@fortawesome/free-solid-svg-icons'; import { faTwitch } from '@fortawesome/free-brands-svg-icons'; import { DEFAULT_MODEL_LANGUAGE, SUPPORTED_MODEL_LANGUAGE_TAG_TO_FULL } from '@storyteller/components/src/i18n/SupportedModelLanguages'; +import { TEXT_PIPELINE_NAMES } from '@storyteller/components/src/constants/TextPipeline'; const DEFAULT_VISIBILITY = 'public'; @@ -34,6 +35,7 @@ function TtsModelEditFc(props: Props) { // Fields const [title, setTitle] = useState(""); + const [textPipelineType, setTextPipelineType] = useState(null); const [descriptionMarkdown, setDescriptionMarkdown] = useState(""); const [fullLanguageTag, setFullLanguageTag] = useState(""); // NB: Should be full IETF, eg. ["en", "en-US", "es-419", etc.] const [visibility, setVisibility] = useState(DEFAULT_VISIBILITY); @@ -48,6 +50,10 @@ function TtsModelEditFc(props: Props) { if (GetTtsModelIsOk(model)) { setTtsModel(model); + // NB: empty string isn't a correct value for Rust to parse as an enum + // Server will also try to send us a guess if we don't have a value set in the DB. + setTextPipelineType(model.text_pipeline_type || model.text_pipeline_type_guess || null) + setTitle(model.title || "") setDescriptionMarkdown(model.description_markdown || "") setFullLanguageTag(model.ietf_language_tag || DEFAULT_MODEL_LANGUAGE) @@ -78,6 +84,10 @@ function TtsModelEditFc(props: Props) { return false; }; + const handleTextPipelineChange = (ev: React.FormEvent) => { + setTextPipelineType((ev.target as HTMLSelectElement).value) + }; + const handleDescriptionMarkdownChange = (ev: React.FormEvent) => { ev.preventDefault(); const textValue = (ev.target as HTMLTextAreaElement).value; @@ -139,6 +149,7 @@ function TtsModelEditFc(props: Props) { creator_set_visibility: visibility || DEFAULT_VISIBILITY, maybe_default_pretrained_vocoder: defaultPretrainedVocoder || DEFAULT_PRETRAINED_VOCODER, ietf_language_tag: fullLanguageTag || DEFAULT_MODEL_LANGUAGE, + text_pipeline_type: textPipelineType, } if (isModerator) { @@ -311,6 +322,23 @@ function TtsModelEditFc(props: Props) { +
+ +
+ +
+
diff --git a/packages/fakeyou/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx b/packages/fakeyou/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx index cef43a8221..10a6d4a103 100644 --- a/packages/fakeyou/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx +++ b/packages/fakeyou/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx @@ -6,6 +6,7 @@ import { SessionWrapper } from '@storyteller/components/src/session/SessionWrapp import { Gravatar } from '@storyteller/components/src/elements/Gravatar'; import { LanguageCodeToDescriptionWithDefault } from '@storyteller/components/src/i18n/SupportedModelLanguages'; import { TtsInferenceJob } from '@storyteller/components/src/jobs/TtsInferenceJobs'; +import { TEXT_PIPELINE_NAMES } from '@storyteller/components/src/constants/TextPipeline'; import { useParams, Link } from 'react-router-dom'; import { v4 as uuidv4 } from 'uuid'; import { FrontendUrlConfig } from '../../../../common/FrontendUrlConfig'; @@ -372,6 +373,12 @@ function TtsModelViewFc(props: Props) { <>/tts {ttsModel?.maybe_suggested_unique_bot_command} : <>not set (ask a moderator in ) ; + const textPipelineType = !!ttsModel.text_pipeline_type ? + ttsModel.text_pipeline_type : + ttsModel.text_pipeline_type_guess; + + let textPipelineName = TEXT_PIPELINE_NAMES.get(textPipelineType) || "Unknown"; + return (

{title}

@@ -418,8 +425,8 @@ function TtsModelViewFc(props: Props) { {defaultVocoder} - Text preprocessing algorithm - {ttsModel?.text_preprocessing_algorithm} + Text pipeline + {textPipelineName} Upload date (UTC)