pvleopard 1.2.2__tar.gz → 2.0.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. {pvleopard-1.2.2 → pvleopard-2.0.1}/MANIFEST.in +3 -4
  2. pvleopard-2.0.1/PKG-INFO +97 -0
  3. {pvleopard-1.2.2 → pvleopard-2.0.1}/README.md +15 -9
  4. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/_factory.py +7 -2
  5. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/_leopard.py +78 -16
  6. pvleopard-2.0.1/pvleopard/lib/common/leopard_params.pv +0 -0
  7. pvleopard-2.0.1/pvleopard/lib/jetson/cortex-a57-aarch64/libpv_leopard.so +0 -0
  8. pvleopard-2.0.1/pvleopard/lib/linux/x86_64/libpv_leopard.so +0 -0
  9. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/lib/mac/arm64/libpv_leopard.dylib +0 -0
  10. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/lib/mac/x86_64/libpv_leopard.dylib +0 -0
  11. pvleopard-2.0.1/pvleopard/lib/raspberry-pi/cortex-a53/libpv_leopard.so +0 -0
  12. pvleopard-2.0.1/pvleopard/lib/raspberry-pi/cortex-a53-aarch64/libpv_leopard.so +0 -0
  13. pvleopard-2.0.1/pvleopard/lib/raspberry-pi/cortex-a72/libpv_leopard.so +0 -0
  14. pvleopard-2.0.1/pvleopard/lib/raspberry-pi/cortex-a72-aarch64/libpv_leopard.so +0 -0
  15. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/lib/windows/amd64/libpv_leopard.dll +0 -0
  16. pvleopard-2.0.1/pvleopard.egg-info/PKG-INFO +97 -0
  17. {pvleopard-1.2.2 → pvleopard-2.0.1}/setup.py +17 -26
  18. pvleopard-1.2.2/PKG-INFO +0 -93
  19. pvleopard-1.2.2/pvleopard/lib/common/leopard_params.pv +0 -0
  20. pvleopard-1.2.2/pvleopard/lib/jetson/cortex-a57-aarch64/libpv_leopard.so +0 -0
  21. pvleopard-1.2.2/pvleopard/lib/linux/x86_64/libpv_leopard.so +0 -0
  22. pvleopard-1.2.2/pvleopard/lib/raspberry-pi/cortex-a53/libpv_leopard.so +0 -0
  23. pvleopard-1.2.2/pvleopard/lib/raspberry-pi/cortex-a53-aarch64/libpv_leopard.so +0 -0
  24. pvleopard-1.2.2/pvleopard/lib/raspberry-pi/cortex-a72/libpv_leopard.so +0 -0
  25. pvleopard-1.2.2/pvleopard/lib/raspberry-pi/cortex-a72-aarch64/libpv_leopard.so +0 -0
  26. pvleopard-1.2.2/pvleopard.egg-info/PKG-INFO +0 -93
  27. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/LICENSE +0 -0
  28. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/__init__.py +0 -0
  29. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard/_util.py +0 -0
  30. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard.egg-info/SOURCES.txt +0 -0
  31. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard.egg-info/dependency_links.txt +0 -0
  32. {pvleopard-1.2.2 → pvleopard-2.0.1}/pvleopard.egg-info/top_level.txt +0 -0
  33. {pvleopard-1.2.2 → pvleopard-2.0.1}/setup.cfg +0 -0
@@ -4,9 +4,8 @@ include pvleopard/_factory.py
4
4
  include pvleopard/_leopard.py
5
5
  include pvleopard/_util.py
6
6
  include pvleopard/lib/common/leopard_params.pv
7
+ recursive-include pvleopard/lib/linux *
8
+ recursive-include pvleopard/lib/mac *
9
+ recursive-include pvleopard/lib/windows *
7
10
  recursive-include pvleopard/lib/jetson *
8
- include pvleopard/lib/linux/x86_64/libpv_leopard.so
9
- include pvleopard/lib/mac/x86_64/libpv_leopard.dylib
10
- include pvleopard/lib/mac/arm64/libpv_leopard.dylib
11
11
  recursive-include pvleopard/lib/raspberry-pi *
12
- include pvleopard/lib/windows/amd64/libpv_leopard.dll
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.1
2
+ Name: pvleopard
3
+ Version: 2.0.1
4
+ Summary: Leopard Speech-to-Text Engine.
5
+ Home-page: https://github.com/Picovoice/leopard
6
+ Author: Picovoice
7
+ Author-email: hello@picovoice.ai
8
+ License: UNKNOWN
9
+ Description: # Leopard Binding for Python
10
+
11
+ ## Leopard Speech-to-Text Engine
12
+
13
+ Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)
14
+
15
+ Leopard is an on-device speech-to-text engine. Leopard is:
16
+
17
+ - Private; All voice processing runs locally.
18
+ - [Accurate](https://picovoice.ai/docs/benchmark/stt/)
19
+ - [Compact and Computationally-Efficient](https://github.com/Picovoice/speech-to-text-benchmark#rtf)
20
+ - Cross-Platform:
21
+ - Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
22
+ - Android and iOS
23
+ - Chrome, Safari, Firefox, and Edge
24
+ - Raspberry Pi (4, 3) and NVIDIA Jetson Nano
25
+
26
+ ## Compatibility
27
+
28
+ - Python 3.5+
29
+ - Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (4, 3), and NVIDIA Jetson Nano.
30
+
31
+ ## Installation
32
+
33
+ ```console
34
+ pip3 install pvleopard
35
+ ```
36
+
37
+ ## AccessKey
38
+
39
+ Leopard requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Leopard SDKs.
40
+ You can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.
41
+ Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.
42
+
43
+ ### Usage
44
+
45
+ Create an instance of the engine and transcribe an audio file:
46
+
47
+ ```python
48
+ import pvleopard
49
+
50
+ leopard = pvleopard.create(access_key='${ACCESS_KEY}')
51
+
52
+ transcript, words = leopard.process_file('${AUDIO_PATH}')
53
+ print(transcript)
54
+ for word in words:
55
+ print(
56
+ "{word=\"%s\" start_sec=%.2f end_sec=%.2f confidence=%.2f}"
57
+ % (word.word, word.start_sec, word.end_sec, word.confidence))
58
+ ```
59
+
60
+ Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://console.picovoice.ai/) and
61
+ `${AUDIO_PATH}` to the path an audio file.
62
+
63
+ Finally, when done be sure to explicitly release the resources:
64
+ ```python
65
+ leopard.delete()
66
+ ```
67
+
68
+ ## Language Model
69
+
70
+ The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
71
+ Default models for other supported languages can be found in [lib/common](../../lib/common).
72
+
73
+ Create custom language models using the [Picovoice Console](https://console.picovoice.ai/). Here you can train
74
+ language models with custom vocabulary and boost words in the existing vocabulary.
75
+
76
+ Pass in the `.pv` file via the `model_path` argument:
77
+ ```python
78
+ leopard = pvleopard.create(
79
+ access_key='${ACCESS_KEY}',
80
+ model_path='${MODEL_PATH}')
81
+ ```
82
+
83
+ ## Demos
84
+
85
+ [pvleoparddemo](https://pypi.org/project/pvleoparddemo/) provides command-line utilities for processing audio using
86
+ Leopard.
87
+
88
+ Keywords: Speech-to-Text,Speech Recognition,Voice Recognition,ASR,Automatic Speech Recognition
89
+ Platform: UNKNOWN
90
+ Classifier: Development Status :: 5 - Production/Stable
91
+ Classifier: Intended Audience :: Developers
92
+ Classifier: License :: OSI Approved :: Apache Software License
93
+ Classifier: Operating System :: OS Independent
94
+ Classifier: Programming Language :: Python :: 3
95
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
96
+ Requires-Python: >=3.5
97
+ Description-Content-Type: text/markdown
@@ -1,10 +1,12 @@
1
- # Leopard Speech-to-Text Engine
1
+ # Leopard Binding for Python
2
+
3
+ ## Leopard Speech-to-Text Engine
2
4
 
3
5
  Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)
4
6
 
5
7
  Leopard is an on-device speech-to-text engine. Leopard is:
6
8
 
7
- - Private; All voice processing runs locally.
9
+ - Private; All voice processing runs locally.
8
10
  - [Accurate](https://picovoice.ai/docs/benchmark/stt/)
9
11
  - [Compact and Computationally-Efficient](https://github.com/Picovoice/speech-to-text-benchmark#rtf)
10
12
  - Cross-Platform:
@@ -37,9 +39,9 @@ Create an instance of the engine and transcribe an audio file:
37
39
  ```python
38
40
  import pvleopard
39
41
 
40
- handle = pvleopard.create(access_key='${ACCESS_KEY}')
42
+ leopard = pvleopard.create(access_key='${ACCESS_KEY}')
41
43
 
42
- transcript, words = handle.process_file('${AUDIO_PATH}')
44
+ transcript, words = leopard.process_file('${AUDIO_PATH}')
43
45
  print(transcript)
44
46
  for word in words:
45
47
  print(
@@ -48,20 +50,24 @@ for word in words:
48
50
  ```
49
51
 
50
52
  Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://console.picovoice.ai/) and
51
- `${AUDIO_PATH}` to the path an audio file. Finally, when done be sure to explicitly release the resources using
52
- `handle.delete()`.
53
+ `${AUDIO_PATH}` to the path an audio file.
54
+
55
+ Finally, when done be sure to explicitly release the resources:
56
+ ```python
57
+ leopard.delete()
58
+ ```
53
59
 
54
60
  ## Language Model
55
61
 
56
- The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
57
- Default models for other supported languages can be found in [lib/common](../../lib/common).
62
+ The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
63
+ Default models for other supported languages can be found in [lib/common](../../lib/common).
58
64
 
59
65
  Create custom language models using the [Picovoice Console](https://console.picovoice.ai/). Here you can train
60
66
  language models with custom vocabulary and boost words in the existing vocabulary.
61
67
 
62
68
  Pass in the `.pv` file via the `model_path` argument:
63
69
  ```python
64
- handle = pvleopard.create(
70
+ leopard = pvleopard.create(
65
71
  access_key='${ACCESS_KEY}',
66
72
  model_path='${MODEL_PATH}')
67
73
  ```
@@ -19,7 +19,8 @@ def create(
19
19
  access_key: str,
20
20
  model_path: Optional[str] = None,
21
21
  library_path: Optional[str] = None,
22
- enable_automatic_punctuation: bool = False) -> Leopard:
22
+ enable_automatic_punctuation: bool = False,
23
+ enable_diarization: bool = False) -> Leopard:
23
24
  """
24
25
  Factory method for Leopard speech-to-text engine.
25
26
 
@@ -28,6 +29,9 @@ def create(
28
29
  :param model_path: Absolute path to the file containing model parameters. If not set it will be set to the default
29
30
  location.
30
31
  :param enable_automatic_punctuation Set to `True` to enable automatic punctuation insertion.
32
+ :param enable_diarization Set to `true` to enable speaker diarization, which allows Leopard to differentiate
33
+ speakers as part of the transcription process. Word metadata will include a `speaker_tag` to
34
+ identify unique speakers.
31
35
  :return: An instance of Leopard speech-to-text engine.
32
36
  """
33
37
 
@@ -41,7 +45,8 @@ def create(
41
45
  access_key=access_key,
42
46
  model_path=model_path,
43
47
  library_path=library_path,
44
- enable_automatic_punctuation=enable_automatic_punctuation)
48
+ enable_automatic_punctuation=enable_automatic_punctuation,
49
+ enable_diarization=enable_diarization)
45
50
 
46
51
 
47
52
  __all__ = [
@@ -18,7 +18,27 @@ from typing import *
18
18
 
19
19
 
20
20
  class LeopardError(Exception):
21
- pass
21
+ def __init__(self, message: str = '', message_stack: Sequence[str] = None):
22
+ super().__init__(message)
23
+
24
+ self._message = message
25
+ self._message_stack = list() if message_stack is None else message_stack
26
+
27
+ def __str__(self):
28
+ message = self._message
29
+ if len(self._message_stack) > 0:
30
+ message += ':'
31
+ for i in range(len(self._message_stack)):
32
+ message += '\n [%d] %s' % (i, self._message_stack[i])
33
+ return message
34
+
35
+ @property
36
+ def message(self) -> str:
37
+ return self._message
38
+
39
+ @property
40
+ def message_stack(self) -> Sequence[str]:
41
+ return self._message_stack
22
42
 
23
43
 
24
44
  class LeopardMemoryError(LeopardError):
@@ -119,14 +139,16 @@ class Leopard(object):
119
139
  ("word", c_char_p),
120
140
  ("start_sec", c_float),
121
141
  ("end_sec", c_float),
122
- ("confidence", c_float)]
142
+ ("confidence", c_float),
143
+ ("speaker_tag", c_int32)]
123
144
 
124
145
  def __init__(
125
146
  self,
126
147
  access_key: str,
127
148
  model_path: str,
128
149
  library_path: str,
129
- enable_automatic_punctuation: bool = False) -> None:
150
+ enable_automatic_punctuation: bool = False,
151
+ enable_diarization: bool = False) -> None:
130
152
  """
131
153
  Constructor.
132
154
 
@@ -134,6 +156,9 @@ class Leopard(object):
134
156
  :param model_path: Absolute path to the file containing model parameters.
135
157
  :param library_path: Absolute path to Leopard's dynamic library.
136
158
  :param enable_automatic_punctuation Set to `True` to enable automatic punctuation insertion.
159
+ :param enable_diarization Set to `true` to enable speaker diarization, which allows Leopard to differentiate
160
+ speakers as part of the transcription process. Word metadata will include a `speaker_tag` to
161
+ identify unique speakers.
137
162
  """
138
163
 
139
164
  if not isinstance(access_key, str) or len(access_key) == 0:
@@ -147,15 +172,36 @@ class Leopard(object):
147
172
 
148
173
  library = cdll.LoadLibrary(library_path)
149
174
 
175
+ set_sdk_func = library.pv_set_sdk
176
+ set_sdk_func.argtypes = [c_char_p]
177
+ set_sdk_func.restype = None
178
+
179
+ set_sdk_func('python'.encode('utf-8'))
180
+
181
+ self._get_error_stack_func = library.pv_get_error_stack
182
+ self._get_error_stack_func.argtypes = [POINTER(POINTER(c_char_p)), POINTER(c_int)]
183
+ self._get_error_stack_func.restype = self.PicovoiceStatuses
184
+
185
+ self._free_error_stack_func = library.pv_free_error_stack
186
+ self._free_error_stack_func.argtypes = [POINTER(c_char_p)]
187
+ self._free_error_stack_func.restype = None
188
+
150
189
  init_func = library.pv_leopard_init
151
- init_func.argtypes = [c_char_p, c_char_p, c_bool, POINTER(POINTER(self.CLeopard))]
190
+ init_func.argtypes = [c_char_p, c_char_p, c_bool, c_bool, POINTER(POINTER(self.CLeopard))]
152
191
  init_func.restype = self.PicovoiceStatuses
153
192
 
154
193
  self._handle = POINTER(self.CLeopard)()
155
194
 
156
- status = init_func(access_key.encode(), model_path.encode(), enable_automatic_punctuation, byref(self._handle))
195
+ status = init_func(
196
+ access_key.encode(),
197
+ model_path.encode(),
198
+ enable_automatic_punctuation,
199
+ enable_diarization,
200
+ byref(self._handle))
157
201
  if status is not self.PicovoiceStatuses.SUCCESS:
158
- raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
202
+ raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
203
+ message='Initialization failed',
204
+ message_stack=self._get_error_stack())
159
205
 
160
206
  self._delete_func = library.pv_leopard_delete
161
207
  self._delete_func.argtypes = [POINTER(self.CLeopard)]
@@ -201,7 +247,7 @@ class Leopard(object):
201
247
  ]
202
248
  self._words_delete_func.restype = None
203
249
 
204
- Word = namedtuple('Word', ['word', 'start_sec', 'end_sec', 'confidence'])
250
+ Word = namedtuple('Word', ['word', 'start_sec', 'end_sec', 'confidence', 'speaker_tag'])
205
251
 
206
252
  def process(self, pcm: Sequence[int]) -> Tuple[str, Sequence[Word]]:
207
253
  """
@@ -227,7 +273,9 @@ class Leopard(object):
227
273
  byref(num_words),
228
274
  byref(c_words))
229
275
  if status is not self.PicovoiceStatuses.SUCCESS:
230
- raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
276
+ raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
277
+ message='Process failed',
278
+ message_stack=self._get_error_stack())
231
279
 
232
280
  transcript = c_transcript.value.decode('utf-8')
233
281
  self._transcript_delete_func(c_transcript)
@@ -238,7 +286,8 @@ class Leopard(object):
238
286
  word=c_words[i].word.decode('utf-8'),
239
287
  start_sec=c_words[i].start_sec,
240
288
  end_sec=c_words[i].end_sec,
241
- confidence=c_words[i].confidence)
289
+ confidence=c_words[i].confidence,
290
+ speaker_tag=c_words[i].speaker_tag)
242
291
  words.append(word)
243
292
 
244
293
  self._words_delete_func(c_words)
@@ -267,12 +316,9 @@ class Leopard(object):
267
316
  byref(num_words),
268
317
  byref(c_words))
269
318
  if status is not self.PicovoiceStatuses.SUCCESS:
270
- if status is self.PicovoiceStatuses.INVALID_ARGUMENT:
271
- if not audio_path.lower().endswith(self._VALID_EXTENSIONS):
272
- raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
273
- "Specified file with extension '%s' is not supported" % pathlib.Path(audio_path).suffix
274
- )
275
- raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
319
+ raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](
320
+ message='Process file failed',
321
+ message_stack=self._get_error_stack())
276
322
 
277
323
  transcript = c_transcript.value.decode('utf-8')
278
324
  self._transcript_delete_func(c_transcript)
@@ -283,7 +329,8 @@ class Leopard(object):
283
329
  word=c_words[i].word.decode('utf-8'),
284
330
  start_sec=c_words[i].start_sec,
285
331
  end_sec=c_words[i].end_sec,
286
- confidence=c_words[i].confidence)
332
+ confidence=c_words[i].confidence,
333
+ speaker_tag=c_words[i].speaker_tag)
287
334
  words.append(word)
288
335
 
289
336
  self._words_delete_func(c_words)
@@ -307,6 +354,21 @@ class Leopard(object):
307
354
 
308
355
  return self._sample_rate
309
356
 
357
+ def _get_error_stack(self) -> Sequence[str]:
358
+ message_stack_ref = POINTER(c_char_p)()
359
+ message_stack_depth = c_int()
360
+ status = self._get_error_stack_func(byref(message_stack_ref), byref(message_stack_depth))
361
+ if status is not self.PicovoiceStatuses.SUCCESS:
362
+ raise self._PICOVOICE_STATUS_TO_EXCEPTION[status](message='Unable to get Leopard error state')
363
+
364
+ message_stack = list()
365
+ for i in range(message_stack_depth.value):
366
+ message_stack.append(message_stack_ref[i].decode('utf-8'))
367
+
368
+ self._free_error_stack_func(message_stack_ref)
369
+
370
+ return message_stack
371
+
310
372
 
311
373
  __all__ = [
312
374
  'Leopard',
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.1
2
+ Name: pvleopard
3
+ Version: 2.0.1
4
+ Summary: Leopard Speech-to-Text Engine.
5
+ Home-page: https://github.com/Picovoice/leopard
6
+ Author: Picovoice
7
+ Author-email: hello@picovoice.ai
8
+ License: UNKNOWN
9
+ Description: # Leopard Binding for Python
10
+
11
+ ## Leopard Speech-to-Text Engine
12
+
13
+ Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)
14
+
15
+ Leopard is an on-device speech-to-text engine. Leopard is:
16
+
17
+ - Private; All voice processing runs locally.
18
+ - [Accurate](https://picovoice.ai/docs/benchmark/stt/)
19
+ - [Compact and Computationally-Efficient](https://github.com/Picovoice/speech-to-text-benchmark#rtf)
20
+ - Cross-Platform:
21
+ - Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
22
+ - Android and iOS
23
+ - Chrome, Safari, Firefox, and Edge
24
+ - Raspberry Pi (4, 3) and NVIDIA Jetson Nano
25
+
26
+ ## Compatibility
27
+
28
+ - Python 3.5+
29
+ - Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (4, 3), and NVIDIA Jetson Nano.
30
+
31
+ ## Installation
32
+
33
+ ```console
34
+ pip3 install pvleopard
35
+ ```
36
+
37
+ ## AccessKey
38
+
39
+ Leopard requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Leopard SDKs.
40
+ You can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.
41
+ Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.
42
+
43
+ ### Usage
44
+
45
+ Create an instance of the engine and transcribe an audio file:
46
+
47
+ ```python
48
+ import pvleopard
49
+
50
+ leopard = pvleopard.create(access_key='${ACCESS_KEY}')
51
+
52
+ transcript, words = leopard.process_file('${AUDIO_PATH}')
53
+ print(transcript)
54
+ for word in words:
55
+ print(
56
+ "{word=\"%s\" start_sec=%.2f end_sec=%.2f confidence=%.2f}"
57
+ % (word.word, word.start_sec, word.end_sec, word.confidence))
58
+ ```
59
+
60
+ Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://console.picovoice.ai/) and
61
+ `${AUDIO_PATH}` to the path an audio file.
62
+
63
+ Finally, when done be sure to explicitly release the resources:
64
+ ```python
65
+ leopard.delete()
66
+ ```
67
+
68
+ ## Language Model
69
+
70
+ The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
71
+ Default models for other supported languages can be found in [lib/common](../../lib/common).
72
+
73
+ Create custom language models using the [Picovoice Console](https://console.picovoice.ai/). Here you can train
74
+ language models with custom vocabulary and boost words in the existing vocabulary.
75
+
76
+ Pass in the `.pv` file via the `model_path` argument:
77
+ ```python
78
+ leopard = pvleopard.create(
79
+ access_key='${ACCESS_KEY}',
80
+ model_path='${MODEL_PATH}')
81
+ ```
82
+
83
+ ## Demos
84
+
85
+ [pvleoparddemo](https://pypi.org/project/pvleoparddemo/) provides command-line utilities for processing audio using
86
+ Leopard.
87
+
88
+ Keywords: Speech-to-Text,Speech Recognition,Voice Recognition,ASR,Automatic Speech Recognition
89
+ Platform: UNKNOWN
90
+ Classifier: Development Status :: 5 - Production/Stable
91
+ Classifier: Intended Audience :: Developers
92
+ Classifier: License :: OSI Approved :: Apache Software License
93
+ Classifier: Operating System :: OS Independent
94
+ Classifier: Programming Language :: Python :: 3
95
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
96
+ Requires-Python: >=3.5
97
+ Description-Content-Type: text/markdown
@@ -14,50 +14,41 @@ import shutil
14
14
 
15
15
  import setuptools
16
16
 
17
+ INCLUDE_FILES = ('../../LICENSE', '__init__.py', '_factory.py', '_leopard.py', '_util.py')
18
+ INCLUDE_LIBS = ('linux', 'mac', 'windows', 'jetson', 'raspberry-pi')
19
+
17
20
  os.system('git clean -dfx')
18
21
 
19
22
  package_folder = os.path.join(os.path.dirname(__file__), 'pvleopard')
20
23
  os.mkdir(package_folder)
24
+ manifest_in = ""
21
25
 
22
- shutil.copy(os.path.join(os.path.dirname(__file__), '../../LICENSE'), package_folder)
23
-
24
- shutil.copy(os.path.join(os.path.dirname(__file__), '__init__.py'), os.path.join(package_folder, '__init__.py'))
25
- shutil.copy(os.path.join(os.path.dirname(__file__), '_factory.py'), os.path.join(package_folder, '_factory.py'))
26
- shutil.copy(os.path.join(os.path.dirname(__file__), '_leopard.py'), os.path.join(package_folder, '_leopard.py'))
27
- shutil.copy(os.path.join(os.path.dirname(__file__), '_util.py'), os.path.join(package_folder, '_util.py'))
26
+ for rel_path in INCLUDE_FILES:
27
+ shutil.copy(os.path.join(os.path.dirname(__file__), rel_path), package_folder)
28
+ manifest_in += "include pvleopard/%s\n" % os.path.basename(rel_path)
28
29
 
29
- platforms = ('jetson', 'linux', 'mac', 'raspberry-pi', 'windows')
30
+ model_file = 'lib/common/leopard_params.pv'
31
+ os.makedirs(os.path.join(package_folder, os.path.split(model_file)[0]))
32
+ shutil.copy(
33
+ os.path.join(os.path.dirname(__file__), '../..', model_file),
34
+ os.path.join(package_folder, model_file))
35
+ manifest_in += "include pvleopard/%s\n" % model_file
30
36
 
31
- os.mkdir(os.path.join(package_folder, 'lib'))
32
- for platform in ('common',) + platforms:
37
+ for platform in INCLUDE_LIBS:
33
38
  shutil.copytree(
34
39
  os.path.join(os.path.dirname(__file__), '../../lib', platform),
35
40
  os.path.join(package_folder, 'lib', platform))
36
-
37
- MANIFEST_IN = """
38
- include pvleopard/LICENSE
39
- include pvleopard/__init__.py
40
- include pvleopard/_factory.py
41
- include pvleopard/_leopard.py
42
- include pvleopard/_util.py
43
- include pvleopard/lib/common/leopard_params.pv
44
- recursive-include pvleopard/lib/jetson *
45
- include pvleopard/lib/linux/x86_64/libpv_leopard.so
46
- include pvleopard/lib/mac/x86_64/libpv_leopard.dylib
47
- include pvleopard/lib/mac/arm64/libpv_leopard.dylib
48
- recursive-include pvleopard/lib/raspberry-pi *
49
- include pvleopard/lib/windows/amd64/libpv_leopard.dll
50
- """
41
+ manifest_in += "recursive-include pvleopard/lib/%s *\n" % platform
51
42
 
52
43
  with open(os.path.join(os.path.dirname(__file__), 'MANIFEST.in'), 'w') as f:
53
- f.write(MANIFEST_IN.strip('\n '))
44
+ f.write(manifest_in)
54
45
 
55
46
  with open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r') as f:
56
47
  long_description = f.read()
57
48
 
58
49
  setuptools.setup(
59
50
  name="pvleopard",
60
- version="1.2.2",
51
+ version="2.0.1",
61
52
  author="Picovoice",
62
53
  author_email="hello@picovoice.ai",
63
54
  description="Leopard Speech-to-Text Engine.",
pvleopard-1.2.2/PKG-INFO DELETED
@@ -1,93 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: pvleopard
3
- Version: 1.2.2
4
- Summary: Leopard Speech-to-Text Engine.
5
- Home-page: https://github.com/Picovoice/leopard
6
- Author: Picovoice
7
- Author-email: hello@picovoice.ai
8
- License: UNKNOWN
9
- Keywords: Speech-to-Text,Speech Recognition,Voice Recognition,ASR,Automatic Speech Recognition
10
- Platform: UNKNOWN
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
17
- Requires-Python: >=3.5
18
- Description-Content-Type: text/markdown
19
-
20
- # Leopard Speech-to-Text Engine
21
-
22
- Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)
23
-
24
- Leopard is an on-device speech-to-text engine. Leopard is:
25
-
26
- - Private; All voice processing runs locally.
27
- - [Accurate](https://picovoice.ai/docs/benchmark/stt/)
28
- - [Compact and Computationally-Efficient](https://github.com/Picovoice/speech-to-text-benchmark#rtf)
29
- - Cross-Platform:
30
- - Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
31
- - Android and iOS
32
- - Chrome, Safari, Firefox, and Edge
33
- - Raspberry Pi (4, 3) and NVIDIA Jetson Nano
34
-
35
- ## Compatibility
36
-
37
- - Python 3.5+
38
- - Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (4, 3), and NVIDIA Jetson Nano.
39
-
40
- ## Installation
41
-
42
- ```console
43
- pip3 install pvleopard
44
- ```
45
-
46
- ## AccessKey
47
-
48
- Leopard requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Leopard SDKs.
49
- You can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.
50
- Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.
51
-
52
- ### Usage
53
-
54
- Create an instance of the engine and transcribe an audio file:
55
-
56
- ```python
57
- import pvleopard
58
-
59
- handle = pvleopard.create(access_key='${ACCESS_KEY}')
60
-
61
- transcript, words = handle.process_file('${AUDIO_PATH}')
62
- print(transcript)
63
- for word in words:
64
- print(
65
- "{word=\"%s\" start_sec=%.2f end_sec=%.2f confidence=%.2f}"
66
- % (word.word, word.start_sec, word.end_sec, word.confidence))
67
- ```
68
-
69
- Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://console.picovoice.ai/) and
70
- `${AUDIO_PATH}` to the path an audio file. Finally, when done be sure to explicitly release the resources using
71
- `handle.delete()`.
72
-
73
- ## Language Model
74
-
75
- The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
76
- Default models for other supported languages can be found in [lib/common](../../lib/common).
77
-
78
- Create custom language models using the [Picovoice Console](https://console.picovoice.ai/). Here you can train
79
- language models with custom vocabulary and boost words in the existing vocabulary.
80
-
81
- Pass in the `.pv` file via the `model_path` argument:
82
- ```python
83
- handle = pvleopard.create(
84
- access_key='${ACCESS_KEY}',
85
- model_path='${MODEL_PATH}')
86
- ```
87
-
88
- ## Demos
89
-
90
- [pvleoparddemo](https://pypi.org/project/pvleoparddemo/) provides command-line utilities for processing audio using
91
- Leopard.
92
-
93
-
@@ -1,93 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: pvleopard
3
- Version: 1.2.2
4
- Summary: Leopard Speech-to-Text Engine.
5
- Home-page: https://github.com/Picovoice/leopard
6
- Author: Picovoice
7
- Author-email: hello@picovoice.ai
8
- License: UNKNOWN
9
- Keywords: Speech-to-Text,Speech Recognition,Voice Recognition,ASR,Automatic Speech Recognition
10
- Platform: UNKNOWN
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
17
- Requires-Python: >=3.5
18
- Description-Content-Type: text/markdown
19
-
20
- # Leopard Speech-to-Text Engine
21
-
22
- Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)
23
-
24
- Leopard is an on-device speech-to-text engine. Leopard is:
25
-
26
- - Private; All voice processing runs locally.
27
- - [Accurate](https://picovoice.ai/docs/benchmark/stt/)
28
- - [Compact and Computationally-Efficient](https://github.com/Picovoice/speech-to-text-benchmark#rtf)
29
- - Cross-Platform:
30
- - Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
31
- - Android and iOS
32
- - Chrome, Safari, Firefox, and Edge
33
- - Raspberry Pi (4, 3) and NVIDIA Jetson Nano
34
-
35
- ## Compatibility
36
-
37
- - Python 3.5+
38
- - Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (4, 3), and NVIDIA Jetson Nano.
39
-
40
- ## Installation
41
-
42
- ```console
43
- pip3 install pvleopard
44
- ```
45
-
46
- ## AccessKey
47
-
48
- Leopard requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Leopard SDKs.
49
- You can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.
50
- Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.
51
-
52
- ### Usage
53
-
54
- Create an instance of the engine and transcribe an audio file:
55
-
56
- ```python
57
- import pvleopard
58
-
59
- handle = pvleopard.create(access_key='${ACCESS_KEY}')
60
-
61
- transcript, words = handle.process_file('${AUDIO_PATH}')
62
- print(transcript)
63
- for word in words:
64
- print(
65
- "{word=\"%s\" start_sec=%.2f end_sec=%.2f confidence=%.2f}"
66
- % (word.word, word.start_sec, word.end_sec, word.confidence))
67
- ```
68
-
69
- Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://console.picovoice.ai/) and
70
- `${AUDIO_PATH}` to the path an audio file. Finally, when done be sure to explicitly release the resources using
71
- `handle.delete()`.
72
-
73
- ## Language Model
74
-
75
- The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
76
- Default models for other supported languages can be found in [lib/common](../../lib/common).
77
-
78
- Create custom language models using the [Picovoice Console](https://console.picovoice.ai/). Here you can train
79
- language models with custom vocabulary and boost words in the existing vocabulary.
80
-
81
- Pass in the `.pv` file via the `model_path` argument:
82
- ```python
83
- handle = pvleopard.create(
84
- access_key='${ACCESS_KEY}',
85
- model_path='${MODEL_PATH}')
86
- ```
87
-
88
- ## Demos
89
-
90
- [pvleoparddemo](https://pypi.org/project/pvleoparddemo/) provides command-line utilities for processing audio using
91
- Leopard.
92
-
93
-
File without changes
File without changes
File without changes