Skip to content

Commit f95c338

Browse files
authored
Merge pull request #2 from nvidia-riva/change_namespace
Change namespace and rename package.
2 parents 79ddf26 + a0e2a25 commit f95c338

34 files changed

+227
-224
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,8 @@ __pycache__/
6262
*.py[cod]
6363
*$py.class
6464

65-
# C extensions
66-
*.so
67-
6865
# Distribution / packaging
6966
.Python
70-
riva/
7167
build/
7268
develop-eggs/
7369
dist/
@@ -187,3 +183,6 @@ tests/integration/asr/outputs
187183
tests/integration/nlp/outputs
188184
tests/integration/tts/outputs
189185

186+
riva/client/proto/*_pb2.py
187+
riva/client/proto/*_pb2_grpc.py
188+

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ case and deliver real-time performance. This repo provides performant client exa
66

77
## Main API
88

9-
- `riva_api.ASRService` is a class for speech recognition,
10-
- `riva_api.TTSService` is a class for speech synthesis,
11-
- `riva_api.NLPService` is a class for natural language processing.
9+
- `riva.client.ASRService` is a class for speech recognition,
10+
- `riva.client.TTSService` is a class for speech synthesis,
11+
- `riva.client.NLPService` is a class for natural language processing.
1212

1313
## CLI interface
1414

@@ -43,12 +43,12 @@ pip install --force-reinstall dist/*.whl
4343
```
4444
3. `pip`:
4545
```bash
46-
pip install riva-api
46+
pip install nvidia-riva-client
4747
```
4848

4949
If you would like to use output and input audio devices
5050
(scripts `scripts/asr/transcribe_file_rt.py`, `scripts/asr/transcribe_mic.py`, `scripts/tts/talk.py` or module
51-
`riva_api/audio_io.py`), you will need to install `PyAudio`.
51+
`riva.client/audio_io.py`), you will need to install `PyAudio`.
5252
```bash
5353
conda install -c anaconda pyaudio
5454
```
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: MIT
33

4-
from riva_api.asr import (
4+
from riva.client.asr import (
55
AudioChunkFileIterator,
66
ASRService,
77
add_audio_file_specs_to_config,
@@ -11,15 +11,15 @@
1111
print_streaming,
1212
sleep_audio_length,
1313
)
14-
from riva_api.auth import Auth
15-
from riva_api.nlp import (
14+
from riva.client.auth import Auth
15+
from riva.client.nlp import (
1616
NLPService,
1717
extract_all_text_classes_and_confidences,
1818
extract_all_token_classification_predictions,
1919
extract_most_probable_text_class_and_confidence,
2020
extract_most_probable_token_classification_predictions,
2121
)
22-
from riva_api.package_info import (
22+
from riva.client.package_info import (
2323
__contact_emails__,
2424
__contact_names__,
2525
__description__,
@@ -32,7 +32,7 @@
3232
__shortversion__,
3333
__version__,
3434
)
35-
from riva_api.proto.riva_asr_pb2 import RecognitionConfig, StreamingRecognitionConfig
36-
from riva_api.proto.riva_audio_pb2 import AudioEncoding
37-
from riva_api.proto.riva_nlp_pb2 import AnalyzeIntentOptions
38-
from riva_api.tts import SpeechSynthesisService
35+
from riva.client.proto.riva_asr_pb2 import RecognitionConfig, StreamingRecognitionConfig
36+
from riva.client.proto.riva_audio_pb2 import AudioEncoding
37+
from riva.client.proto.riva_nlp_pb2 import AnalyzeIntentOptions
38+
from riva.client.tts import SpeechSynthesisService
File renamed without changes.

riva_api/asr.py renamed to riva/client/asr.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
from grpc._channel import _MultiThreadedRendezvous
1414

15-
import riva_api.proto.riva_asr_pb2 as rasr
16-
import riva_api.proto.riva_asr_pb2_grpc as rasr_srv
17-
from riva_api.auth import Auth
15+
import riva.client.proto.riva_asr_pb2 as rasr
16+
import riva.client.proto.riva_asr_pb2_grpc as rasr_srv
17+
from riva.client.auth import Auth
1818

1919

2020
def get_wav_file_parameters(input_file: Union[str, os.PathLike]) -> Dict[str, Union[int, float]]:
@@ -114,7 +114,7 @@ def print_streaming(
114114
Prints streaming speech recognition results to provided files or streams.
115115
116116
Args:
117-
responses (:obj:`Iterable[riva_api.proto.riva_asr_pb2.StreamingRecognizeResponse]`): responses acquired during
117+
responses (:obj:`Iterable[riva.client.proto.riva_asr_pb2.StreamingRecognizeResponse]`): responses acquired during
118118
streaming speech recognition.
119119
output_file (:obj:`Union[Union[os.PathLike, str, TextIO], List[Union[os.PathLike, str, TextIO]]]`, `optional`):
120120
a path to an output file or a text stream or a list of paths/streams. If contains several elements, then
@@ -261,7 +261,7 @@ def __init__(self, auth: Auth) -> None:
261261
Initializes an instance of the class.
262262
263263
Args:
264-
auth (:obj:`riva_api.auth.Auth`): an instance of :class:`riva_api.auth.Auth` which is used for
264+
auth (:obj:`riva.client.auth.Auth`): an instance of :class:`riva.client.auth.Auth` which is used for
265265
authentication metadata generation.
266266
"""
267267
self.auth = auth
@@ -287,20 +287,20 @@ def streaming_response_generator(
287287
with wave.open(file_name, 'rb') as wav_f:
288288
raw_audio = wav_f.readframes(n_frames)
289289
290-
streaming_config (:obj:`riva_api.proto.riva_asr_pb2.StreamingRecognitionConfig`): a config for streaming.
290+
streaming_config (:obj:`riva.client.proto.riva_asr_pb2.StreamingRecognitionConfig`): a config for streaming.
291291
You may find description of config fields in message ``StreamingRecognitionConfig`` in
292292
`common repo
293293
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-asr-proto>`_.
294294
An example of creation of streaming config:
295295
296296
.. code-style:: python
297297
298-
from riva_api import RecognitionConfig, StreamingRecognitionConfig
298+
from riva.client import RecognitionConfig, StreamingRecognitionConfig
299299
config = RecognitionConfig(enable_automatic_punctuation=True)
300300
streaming_config = StreamingRecognitionConfig(config, interim_results=True)
301301
302302
Yields:
303-
:obj:`riva_api.proto.riva_asr_pb2.StreamingRecognizeResponse`: responses for audio chunks in
303+
:obj:`riva.client.proto.riva_asr_pb2.StreamingRecognizeResponse`: responses for audio chunks in
304304
:param:`audio_chunks`. You may find description of response fields in declaration of
305305
``StreamingRecognizeResponse``
306306
message `here
@@ -326,21 +326,21 @@ def offline_recognize(
326326
with wave.open(file_name, 'rb') as wav_f:
327327
raw_audio = wav_f.readframes(n_frames)
328328
329-
config (:obj:`riva_api.proto.riva_asr_pb2.RecognitionConfig`): a config for offline speech recognition.
329+
config (:obj:`riva.client.proto.riva_asr_pb2.RecognitionConfig`): a config for offline speech recognition.
330330
You may find description of config fields in message ``RecognitionConfig`` in
331331
`common repo
332332
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-asr-proto>`_.
333333
An example of creation of config:
334334
335335
.. code-style:: python
336336
337-
from riva_api import RecognitionConfig
337+
from riva.client import RecognitionConfig
338338
config = RecognitionConfig(enable_automatic_punctuation=True)
339339
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
340340
response. You can get a response by calling ``result()`` method of the future object.
341341
342342
Returns:
343-
:obj:`Union[riva_api.proto.riva_asr_pb2.RecognizeResponse, grpc._channel._MultiThreadedRendezvous]``: a
343+
:obj:`Union[riva.client.proto.riva_asr_pb2.RecognizeResponse, grpc._channel._MultiThreadedRendezvous]``: a
344344
response with results of :param:`audio_bytes` processing. You may find description of response fields in
345345
declaration of ``RecognizeResponse`` message `here
346346
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-asr-proto>`_.
File renamed without changes.
File renamed without changes.
File renamed without changes.

riva_api/nlp.py renamed to riva/client/nlp.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from google.protobuf.message import Message
77
from grpc._channel import _MultiThreadedRendezvous
88

9-
import riva_api.proto.riva_nlp_pb2 as rnlp
10-
import riva_api.proto.riva_nlp_pb2_grpc as rnlp_srv
11-
from riva_api import Auth
9+
import riva.client.proto.riva_nlp_pb2 as rnlp
10+
import riva.client.proto.riva_nlp_pb2_grpc as rnlp_srv
11+
from riva.client import Auth
1212

1313

1414
def extract_all_text_classes_and_confidences(
@@ -103,7 +103,7 @@ def __init__(self, auth: Auth) -> None:
103103
Initializes an instance of the class.
104104
105105
Args:
106-
auth (:obj:`Auth`): an instance of :class:`riva_api.auth.Auth` which is used for
106+
auth (:obj:`Auth`): an instance of :class:`riva.client.auth.Auth` which is used for
107107
authentication metadata generation.
108108
"""
109109
self.auth = auth
@@ -125,7 +125,7 @@ def classify_text(
125125
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
126126
response. You can get a response by calling ``result()`` method of the future object.
127127
Returns:
128-
:obj:`Union[riva_api.proto.riva_nlp_pb2.TextClassResponse, grpc._channel._MultiThreadedRendezvous]`: a
128+
:obj:`Union[riva.client.proto.riva_nlp_pb2.TextClassResponse, grpc._channel._MultiThreadedRendezvous]`: a
129129
response with :param:`input_strings` classification results. You may find :class:`TextClassResponse`
130130
fields description `here
131131
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
@@ -158,7 +158,7 @@ def classify_tokens(
158158
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
159159
response. You can get a response by calling ``result()`` method of the future object.
160160
Returns:
161-
:obj:`Union[riva_api.proto.riva_nlp_pb2.TokenClassResponse, grpc._channel._MultiThreadedRendezvous]`: a
161+
:obj:`Union[riva.client.proto.riva_nlp_pb2.TokenClassResponse, grpc._channel._MultiThreadedRendezvous]`: a
162162
response with results. You may find :class:`TokenClassResponse` fields description `here
163163
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
164164
If :param:`future` is :obj:`True`, then a future object is returned. You may retrieve a response from a
@@ -189,7 +189,7 @@ def transform_text(
189189
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
190190
response. You can get a response by calling ``result()`` method of the future object.
191191
Returns:
192-
:obj:`Union[riva_api.proto.riva_nlp_pb2.TextTransformResponse, grpc._channel._MultiThreadedRendezvous]`: a
192+
:obj:`Union[riva.client.proto.riva_nlp_pb2.TextTransformResponse, grpc._channel._MultiThreadedRendezvous]`: a
193193
model response. You may find :class:`TextTransformResponse` fields description `here
194194
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
195195
If :param:`future` is :obj:`True`, then a future object is returned. You may retrieve a response from a
@@ -211,7 +211,7 @@ def analyze_entities(
211211
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
212212
response. You can get a response by calling ``result()`` method of the future object.
213213
Returns:
214-
:obj:`Union[riva_api.proto.riva_nlp_pb2.TokenClassResponse, grpc._channel._MultiThreadedRendezvous]`: a
214+
:obj:`Union[riva.client.proto.riva_nlp_pb2.TokenClassResponse, grpc._channel._MultiThreadedRendezvous]`: a
215215
model response. You may find :class:`TokenClassResponse` fields description `here
216216
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
217217
If :param:`future` is :obj:`True`, then a future object is returned. You may retrieve a response from a
@@ -233,15 +233,15 @@ def analyze_intent(
233233
234234
Args:
235235
input_string (:obj:`str`): a string which will be classified.
236-
options (:obj:`riva_api.proto.riva_nlp_pb2.AnalyzeIntentOptions`, `optional`,
237-
defaults to :obj:`riva_api.proto.riva_nlp_pb2.AnalyzeIntentOptions()`):
236+
options (:obj:`riva.client.proto.riva_nlp_pb2.AnalyzeIntentOptions`, `optional`,
237+
defaults to :obj:`riva.client.proto.riva_nlp_pb2.AnalyzeIntentOptions()`):
238238
an intent options. You may find fields description `here
239239
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
240240
Defaults to an instance of :obj:`AnalyzeIntentOptions` created without parameters.
241241
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
242242
response. You can get a response by calling ``result()`` method of the future object.
243243
Returns:
244-
:obj:`Union[riva_api.proto.riva_nlp_pb2.AnalyzeIntentResponse, grpc._channel._MultiThreadedRendezvous]`: a
244+
:obj:`Union[riva.client.proto.riva_nlp_pb2.AnalyzeIntentResponse, grpc._channel._MultiThreadedRendezvous]`: a
245245
response with results. You may find fields description `here
246246
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
247247
If :param:`future` is :obj:`True`, then a future object is returned. You may retrieve a response from a
@@ -272,7 +272,7 @@ def punctuate_text(
272272
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
273273
response. You can get a response by calling ``result()`` method of the future object.
274274
Returns:
275-
:obj:`Union[riva_api.proto.riva_nlp_pb2.TextTransformResponse, grpc._channel._MultiThreadedRendezvous]`: a
275+
:obj:`Union[riva.client.proto.riva_nlp_pb2.TextTransformResponse, grpc._channel._MultiThreadedRendezvous]`: a
276276
response with results. You may find fields description `here
277277
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
278278
If :param:`future` is :obj:`True`, then a future object is returned. You may retrieve a response from a
@@ -296,7 +296,7 @@ def natural_query(
296296
future (:obj:`bool`, defaults to :obj:`False`): whether to return an async result instead of usual
297297
response. You can get a response by calling ``result()`` method of the future object.
298298
Returns:
299-
:obj:`Union[riva_api.proto.riva_nlp_pb2.NaturalQueryResult, grpc._channel._MultiThreadedRendezvous]`: a
299+
:obj:`Union[riva.client.proto.riva_nlp_pb2.NaturalQueryResult, grpc._channel._MultiThreadedRendezvous]`: a
300300
response with a result. You may find fields description `here
301301
<https://docs.nvidia.com/deeplearning/riva/user-guide/docs/reference/protos/protos.html#riva-proto-riva-nlp-proto>`_.
302302
If :param:`future` is :obj:`True`, then a future object is returned. You may retrieve a response from a

riva_api/package_info.py renamed to riva/client/package_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
__shortversion__ = '.'.join(map(str, VERSION[:3]))
1313
__version__ = '.'.join(map(str, VERSION[:3])) + ''.join(VERSION[3:])
1414

15-
__package_name__ = 'riva-api'
15+
__package_name__ = 'nvidia-riva-client'
1616
__contact_names__ = 'Anton Peganov'
1717
__contact_emails__ = '[email protected]'
1818
__homepage__ = 'https://github.com/nvidia-riva/python-clients'
1919
__repository_url__ = 'https://github.com/nvidia-riva/python-clients'
2020
__download_url__ = 'hhttps://github.com/nvidia-riva/python-clients/releases'
21-
__description__ = "Python implementation of the Riva API"
21+
__description__ = "Python implementation of the Riva Client API"
2222
__license__ = 'MIT'
2323
__keywords__ = 'deep learning, machine learning, gpu, NLP, ASR, TTS, nvidia, speech, language, Riva, client'
2424
__riva_version__ = "2.2.0"

0 commit comments

Comments
 (0)