Package ai.djl.modality.audio.translator
Class SpeechRecognitionTranslator
- java.lang.Object
-
- ai.djl.modality.audio.translator.SpeechRecognitionTranslator
-
- All Implemented Interfaces:
NoBatchifyTranslator<Audio,java.lang.String>,PostProcessor<java.lang.String>,PreProcessor<Audio>,Translator<Audio,java.lang.String>
public class SpeechRecognitionTranslator extends java.lang.Object implements NoBatchifyTranslator<Audio,java.lang.String>
-
-
Constructor Summary
Constructors Constructor Description SpeechRecognitionTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NDListprocessInput(TranslatorContext ctx, Audio input)Processes the input and converts it to NDList.java.lang.StringprocessOutput(TranslatorContext ctx, NDList list)Processes the output NDList to the corresponding output object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ai.djl.translate.NoBatchifyTranslator
getBatchifier
-
Methods inherited from interface ai.djl.translate.Translator
getExpansions, prepare, toBatchTranslator, toBatchTranslator
-
-
-
-
Method Detail
-
processInput
public NDList processInput(TranslatorContext ctx, Audio input) throws java.lang.Exception
Processes the input and converts it to NDList.- Specified by:
processInputin interfacePreProcessor<Audio>- Parameters:
ctx- the toolkit for creating the input NDArrayinput- the input object- Returns:
- the
NDListafter pre-processing - Throws:
java.lang.Exception- if an error occurs during processing input
-
processOutput
public java.lang.String processOutput(TranslatorContext ctx, NDList list) throws java.lang.Exception
Processes the output NDList to the corresponding output object.- Specified by:
processOutputin interfacePostProcessor<java.lang.String>- Parameters:
ctx- the toolkit used for post-processinglist- the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774- Returns:
- the output object of expected type
- Throws:
java.lang.Exception- if an error occurs during processing output
-
-