Command-line Clients ==================== A Docker image containing sample command-line drivers for the Jarvis services is available on NGC. Pull and run the container by using the commands below. The client expects that a Jarvis server is running with models deployed, and all command-line drivers accept an optional argument to specify the location of the server. No GPU is required to run the sample clients. .. prompt:: bash :substitutions: docker pull nvcr.io/|NgcOrgTeam|/jarvis-clients:|VersionNum| docker run -it --rm nvcr.io/|NgcOrgTeam|/jarvis-clients:|VersionNum| Speech Recognition ------------------ Both binary C++ and Python clients are included in the Docker image with options to do ASR inference in **streaming** as well as **offline (non-streaming)** mode. C++ Streaming Example ~~~~~~~~~~~~~~~~~~~~~ Running the C++ ASR streaming client, where ``--audio_file`` is used to specify the audio file that is to be transcribed. Other options can be found in ``jarvis_streaming_asr_client.cc``. .. prompt:: bash jarvis_streaming_asr_client --audio_file /work/wav/test/1272-135031-0001.wav C++ Offline/Batch (non-streaming) Example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running the C++ ASR offline client, where ``--audio_file`` is used to specify the audio file that is to be transcribed. Other options can be found in ``jarvis_asr_client.cc``. .. prompt:: bash jarvis_asr_client --audio_file /work/wav/test/1272-135031-0001.wav Python Streaming Example ~~~~~~~~~~~~~~~~~~~~~~~~ Running the Python ASR streaming client, where ``--input-file`` is used to specify the audio file that is to be transcribed. Other options can be found in ``jarvis_streaming_asr_client.py``. .. prompt:: bash python jarvis_streaming_asr_client.py --input-file=/work/wav/test/1272-135031-0001.wav Other Python ASR clients are also available: #. ``transcribe_file.py`` transcribes audio files in streaming mode. #. ``transcribe_file_offline.py`` transcribes audio files in offline mode. #. ``transcribe_file_rt.py`` transcribes audio files while playing back through PyAudio stream. #. ``transcribe_mic.py`` transcribes audio from a microphone device. Natural Language Processing --------------------------- Both binary C++ and Python clients are included in the Docker image for supported NLP tasks. C++ NER Example ~~~~~~~~~~~~~~~ Running C++ Token Classification Model (NER) where ``--queries`` is used to specify the query file in which to provide token labels for. Other options can be found in ``jarvis_nlp_classify_tokens.cc``. .. prompt:: bash jarvis_nlp_classify_tokens --queries=/work/test_files/nlu/queries.txt C++ QA Example ~~~~~~~~~~~~~~ Running the C++ Question Answering client where ``--questions`` is used to specify the file containing questions and ``--contexts`` is used to specify the file containing the context paragraph. Other options can be found in ``jarvis_nlp_qa.cc``. .. prompt:: bash jarvis_nlp_qa --questions=/work/test_files/nlu/qa_questions.txt --contexts=/work/test_files/nlu/qa_contexts.txt Python QA Example ~~~~~~~~~~~~~~~~~ Running the Python Question Answering client. Modify ``test_context`` and ``req.query`` in the ``test_qa.py`` script to try different QA examples. .. prompt:: bash python test_qa.py C++ Punctuation Example ~~~~~~~~~~~~~~~~~~~~~~~ Running the C++ Punctuation client where ``--queries`` is used to specify the file containing inputs to punctuate. Note that, if you want to specify ``--output`` to write output of the punctuation model to a file, you need to also specify ``--parallel_requests=1``. .. prompt:: bash jarvis_nlp_punct --queries=/work/test_files/nlu/punctuation_input.txt Speech Synthesis ---------------- Binary C++ clients are supported in the Docker image for TTS. C++ TTS Client Example ~~~~~~~~~~~~~~~~~~~~~~ Running the C++ TTS client where ``--text`` is used to specify the input text for which to synthesize audio. The output of the client is a ``wav`` file which can be specified by ``--audio_file``. Other options can be found in ``jarvis_tts_client.cc``. .. prompt:: bash jarvis_tts_client --text="I had a dream yesterday." C++ TTS Performance Client Example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running the C++ TTS Performance client which will provide information about latency and throughput. Options ``--text`` can be used to specify the input text and ``--text_file`` can be used to specify the file containing multiple text inputs. Other options can be found in ``jarvis_tts_perf_client.cc``. .. prompt:: bash jarvis_tts_perf_client --text_file=/work/test_files/tts/ljs_audio_text_test_filelist_small.txt Python Client Examples ~~~~~~~~~~~~~~~~~~~~~~ Two command line clients implemented in Python are provided as an example of how to interact with the TTS service using the Python API. `talk.py` is an implementation of a client for performing offline inference, and `talk_stream.py` an implementation using online inference (with audio being streamed back to the client in chunks).