Update runner README and improve Python 2 support

pull/10/head
Matthew D. Scholefield 2018-03-29 02:23:15 -05:00
parent 1449aae3a8
commit fbdba9bfdd
2 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,29 @@
# Precise Wrapper
A simple to use
A simple to use, lightweight Python module for using Mycroft Precise.
## Usage:
First, download the precise binary from [the precise-data repo][precise-data].
Next, extract the tar to the folder of your choice. The following commands will
work for a desktop:
[precise-data]: https://github.com/mycroftai/precise-data/tree/dist
```bash
ARCH=x86_64
wget https://github.com/MycroftAI/precise-data/raw/dist/$ARCH/precise-engine.tar.gz
tar xvf precise-engine.tar.gz
```
Finally, you can create a program as follows, passing in the location of
the executable as the first argument:
```python
#!/usr/bin/env python3
from precise_runner import PreciseEngine, PreciseRunner
engine = PreciseEngine('precise-engine/precise-engine', 'my_model_file.pb')
runner = PreciseRunner(engine, on_activation=lambda: print('hello'))
```

View File

@ -71,7 +71,7 @@ class ListenerEngine(Engine):
self.get_prediction = listener.update
class ReadWriteStream:
class ReadWriteStream(object):
"""Class used to support writing binary audio data at any pace"""
def __init__(self, s=b''):
self.buffer = s
@ -92,7 +92,7 @@ class ReadWriteStream:
self.write_event.set()
class PreciseRunner:
class PreciseRunner(object):
"""
Wrapper to use Precise. Example:
>>> def on_act():