feat: nvidia tts/stt speech (#201)

* feat: nvidia tts/stt speech

* fix: rename riva server uri

* fix: review comments

* fix: review comments

* sort vendors in alphabetic order

---------

Co-authored-by: Quan HL <quanluuhoang8@gmail.com>
Co-authored-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
Hoan Luu Huu
2023-02-13 20:37:32 +07:00
committed by GitHub
parent 6df9f0d6da
commit 1be5dcc06b
6 changed files with 137 additions and 12 deletions
+1
View File
@@ -307,6 +307,7 @@ export interface SpeechCredential {
stt_api_key: null | string;
stt_region: null | string;
instance_id: null | string;
riva_server_uri: null | string;
}
export interface Alert {
@@ -26,6 +26,7 @@ import {
VENDOR_WELLSAID,
VENDOR_DEEPGRAM,
VENDOR_IBM,
VENDOR_NVIDIA,
} from "src/vendor";
import { MSG_REQUIRED_FIELDS } from "src/constants";
import {
@@ -75,6 +76,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
const [tmpCustomTtsEndpoint, setTmpCustomTtsEndpoint] = useState("");
const [customSttEndpoint, setCustomSttEndpoint] = useState("");
const [tmpCustomSttEndpoint, setTmpCustomSttEndpoint] = useState("");
const [rivaServerUri, setRivaServerUri] = useState("");
const handleFile = (file: File) => {
const handleError = () => {
@@ -136,6 +138,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
tts_api_key: ttsApiKey || null,
tts_region: ttsRegion || null,
}),
...(vendor === VENDOR_NVIDIA && {
riva_server_uri: rivaServerUri || null,
}),
};
if (credential && credential.data) {
@@ -173,6 +178,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
: null,
client_id: vendor === VENDOR_NUANCE ? clientId : null,
secret: vendor === VENDOR_NUANCE ? secretKey : null,
riva_server_uri: vendor == VENDOR_NVIDIA ? rivaServerUri : null,
})
.then(() => {
toastSuccess("Speech credential created successfully");
@@ -261,6 +267,10 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
setInstanceId(credential.data.instance_id);
}
if (credential.data.riva_server_uri) {
setRivaServerUri(credential.data.riva_server_uri);
}
setUseCustomTts(credential.data.use_custom_tts > 0 ? true : false);
setUseCustomStt(credential.data.use_custom_stt > 0 ? true : false);
setCustomTtsEndpoint(credential.data.custom_tts_endpoint || "");
@@ -626,6 +636,24 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
</fieldset>
</React.Fragment>
)}
{vendor === VENDOR_NVIDIA && (
<React.Fragment>
<fieldset>
<label htmlFor="riva_server_uri">
Riva Server Uri<span>*</span>
</label>
<input
id="riva_server_uri"
type="text"
name="riva_server_uri"
placeholder="Riva Server Uri"
value={rivaServerUri}
onChange={(e) => setRivaServerUri(e.target.value)}
/>
</fieldset>
</React.Fragment>
)}
<fieldset>
<ButtonGroup left>
<Button small subStyle="grey" as={Link} to={ROUTE_INTERNAL_SPEECH}>
+21 -10
View File
@@ -16,35 +16,40 @@ export const VENDOR_WELLSAID = "wellsaid";
export const VENDOR_NUANCE = "nuance";
export const VENDOR_DEEPGRAM = "deepgram";
export const VENDOR_IBM = "ibm";
export const VENDOR_NVIDIA = "nvidia";
export const vendors: VendorOptions[] = [
{
name: "AWS",
value: VENDOR_AWS,
},
{
name: "Google",
value: VENDOR_GOOGLE,
},
{
name: "AWS",
value: VENDOR_AWS,
name: "Deepgram",
value: VENDOR_DEEPGRAM,
},
{
name: "IBM",
value: VENDOR_IBM,
},
{
name: "Microsoft",
value: VENDOR_MICROSOFT,
},
{
name: "WellSaid",
value: VENDOR_WELLSAID,
},
{
name: "Nuance",
value: VENDOR_NUANCE,
},
{
name: "deepgram",
value: VENDOR_DEEPGRAM,
name: "Nvidia",
value: VENDOR_NVIDIA,
},
{
name: "IBM",
value: VENDOR_IBM,
name: "WellSaid",
value: VENDOR_WELLSAID,
},
];
@@ -98,12 +103,14 @@ export const useSpeechVendors = () => {
import("./speech-recognizer/nuance-speech-recognizer-lang"),
import("./speech-recognizer/deepgram-speech-recognizer-lang"),
import("./speech-recognizer/ibm-speech-recognizer-lang"),
import("./speech-recognizer/nvidia-speech-recognizer-lang"),
import("./speech-synthesis/aws-speech-synthesis-lang"),
import("./speech-synthesis/google-speech-synthesis-lang"),
import("./speech-synthesis/ms-speech-synthesis-lang"),
import("./speech-synthesis/wellsaid-speech-synthesis-lang"),
import("./speech-synthesis/nuance-speech-synthesis-lang"),
import("./speech-synthesis/ibm-speech-synthesis-lang"),
import("./speech-synthesis/nvidia-speech-synthesis-lang"),
]).then(
([
{ default: awsRecognizer },
@@ -112,12 +119,14 @@ export const useSpeechVendors = () => {
{ default: nuanceRecognizer },
{ default: deepgramRecognizer },
{ default: ibmRecognizer },
{ default: nvidiaRecognizer },
{ default: awsSynthesis },
{ default: googleSynthesis },
{ default: msSynthesis },
{ default: wellsaidSynthesis },
{ default: nuanceSynthesis },
{ default: ibmSynthesis },
{ default: nvidiaynthesis },
]) => {
if (!ignore) {
setSpeech({
@@ -128,6 +137,7 @@ export const useSpeechVendors = () => {
wellsaid: wellsaidSynthesis,
nuance: nuanceSynthesis,
ibm: ibmSynthesis,
nvidia: nvidiaynthesis,
},
recognizers: {
aws: awsRecognizer,
@@ -136,6 +146,7 @@ export const useSpeechVendors = () => {
nuance: nuanceRecognizer,
deepgram: deepgramRecognizer,
ibm: ibmRecognizer,
nvidia: nvidiaRecognizer,
},
});
}
@@ -0,0 +1,62 @@
import type { Language } from "../types";
export const languages: Language[] = [
{
name: "Arabic",
code: "ar-AR",
},
{
name: "English",
code: "en-US",
},
{
name: "English - GB",
code: "en-GB",
},
{
name: "Spanish - US",
code: "es-US",
},
{
name: "Spanish",
code: "es-ES",
},
{
name: "German",
code: "de-DE",
},
{
name: "French",
code: "fr-FR",
},
{
name: "Hindi",
code: "hi-IN",
},
{
name: "Russian",
code: "ru-RU",
},
{
name: "Korean",
code: "ko-KR",
},
{
name: "Brazilian-Portuguese",
code: "pt-BR",
},
{
name: "Japanese",
code: "ja-JP",
},
{
name: "Italian",
code: "it-IT",
},
{
name: "Mandarin",
code: "zh-CN",
},
];
export default languages;
@@ -0,0 +1,20 @@
import type { VoiceLanguage } from "../types";
export const languages: VoiceLanguage[] = [
{
code: "en-US",
name: "English",
voices: [
{
value: "English-US.Female-1",
name: "Female",
},
{
value: "English-US.Male-1",
name: "Male",
},
],
},
];
export default languages;
+5 -2
View File
@@ -4,8 +4,9 @@ export type Vendor =
| "Microsoft"
| "WellSaid"
| "Nuance"
| "deepgram"
| "IBM";
| "Deepgram"
| "IBM"
| "Nvidia";
export interface VendorOptions {
name: Vendor;
@@ -60,6 +61,7 @@ export interface RecognizerVendors {
nuance: Language[];
deepgram: Language[];
ibm: Language[];
nvidia: Language[];
}
export interface SynthesisVendors {
@@ -69,6 +71,7 @@ export interface SynthesisVendors {
wellsaid: VoiceLanguage[];
nuance: VoiceLanguage[];
ibm: VoiceLanguage[];
nvidia: VoiceLanguage[];
}
export interface MSRawSpeech {