deephaven.ui plugin to use voice to control a table
Project description
deephaven-plugin-voice-table
This is a Python plugin for Deephaven generated from a deephaven-plugin template.
This plugin display a table with a voice control interface. Press and hold the micrphone button, speak a command, and the table will update with the filters and sorts you specified.
Plugin Structure
The src
directory contains the Python and JavaScript code for the plugin.
Within the src
directory, the deephaven_plugin_voice_table directory contains the Python code.
Additionally, the test
directory contains Python tests for the plugin. This demonstrates how the embedded Deephaven server can be used in tests.
It's recommended to use tox
to run the tests, and the tox.ini
file is included in the project.
Building the Plugin
To build the plugin, you will need python
installed, as well as the build
package for Python.
The python venv can be created and the recommended packages installed with the following commands:
cd deephaven_plugin_voice_table
python -m venv .venv
source .venv/bin/activate
pip install --upgrade -r requirements.txt
Then, build the Python plugin from the top-level directory:
python -m build --wheel
The built wheel file will be located in the dist
directory.
Installing the Plugin
The plugin can be installed into a Deephaven instance with pip install <wheel file>
.
The wheel file is stored in the dist
directory after building the plugin.
Exactly how this is done will depend on how you are running Deephaven.
If using the venv created above, the plugin and server can be created with the following commands:
pip install deephaven-server
pip install dist/deephaven_plugin_voice_table-0.0.1.dev0-py3-none-any.whl
deephaven server
See the plug-in documentation for more information.
Using the Plugin
Once the Deephaven server is running, the plugin should be available to use.
For a basic example, run the following code:
from deephaven import new_table
from deephaven.column import string_col, int_col
from deephaven_plugin_voice_table import ui_voice_table
_basic_table = new_table(
[
string_col("First", ["John", "Jane", "John", "Mike", "Jane", "Bob"]),
string_col("Last", ["Doe", "Smith", "Cruise", "Smith", "Doe", "Smith"]),
int_col("Id", [1, 2, 3, 4, 5, 6])
]
)
vc_basic_table = ui_voice_table(_basic_table)
A panel should appear with a table and a microphone. Click and hold the microphone, speak a command, and release the microphone to apply the command. Some example commands you could speak:
- Filter a column: "Filter by ", e.g. "Filter First by John"
- Sort a column: "Sort <ascending/descending>", e.g. "Sort First descending"
- Multiple commands you can separate with "and", e.g. "Filter First by John and Sort Last descending"
For a more complex example, install the deephaven-plugin-plotly-express
plugin for some extra data sets and run the following:
from deephaven_plugin_voice_table import ui_voice_table
import deephaven.plot.express as dx
_stocks = dx.data.stocks()
vc_stocks = ui_voice_table(_stocks)
Say a command like "Filter sym by CAT and filter exchange by PETX and sort size down" to see the table update:
Distributing the Plugin
To distribute the plugin, you can upload the wheel file to a package repository, such as PyPI.
The version of the plugin can be updated in the setup.cfg
file.
There is a separate instance of PyPI for testing purposes. Start by creating an account at TestPyPI. Then, get an API token from account management, setting the “Scope” to “Entire account”.
To upload to the test instance, use the following commands:
python -m pip install --upgrade twine
python -m twine upload --repository testpypi dist/*
Now, you can install the plugin from the test instance. The extra index is needed to find dependencies:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ deephaven-plugin-voice-table
For a production release, create an account at PyPI. Then, get an API token from account management, setting the “Scope” to “Entire account”.
To upload to the production instance, use the following commands.
Note that --repository
is the production instance by default, so it can be omitted:
python -m pip install --upgrade twine
python -m twine upload dist/*
Now, you can install the plugin from the production instance:
pip install deephaven-plugin-voice-table
See the Python packaging documentation for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for deephaven_plugin_voice_table-0.0.1.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c76fcdfd49f91e9d69d9d933b10520523fbb6710588b66377f6c85808d0cd179 |
|
MD5 | ba6ca0a089eb94f6e299542b1469f500 |
|
BLAKE2b-256 | beec447e209902176b7df45654b9275c9c9dae3bab5657476ba0fcdaa5330561 |