-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6caa739
commit 449cf8a
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Python Dataflow Example | ||
|
||
This examples shows how to create and connect dora nodes in Python. | ||
|
||
## Overview | ||
|
||
The [`dataflow.yml`](./dataflow.yml) defines a simple dataflow graph with the following three nodes: | ||
|
||
- a webcam node, that connects to your webcam and feed the dataflow with webcam frame as jpeg compressed bytearray. | ||
- a window plotting node, that will retrieve the webcam image and plot it. | ||
|
||
The same dataflow is implemented for a `dynamic-node` in [`dataflow_dynamic.yml`](./dataflow_dynamic.yml). It contains | ||
the same nodes as the previous dataflow, but the plot node is a dynamic node. See the next section for more | ||
information on how to start such a dataflow. | ||
|
||
## Getting started | ||
|
||
After installing Rust, `dora-cli` and `Python >3.11`, you will need to **activate** (or create and **activate**) a | ||
[Python virtual environment](https://docs.python.org/3/library/venv.html). | ||
Then, you will need to install the dependencies: | ||
|
||
```bash | ||
cd examples/python-dataflow | ||
dora build ./dataflow.yml (or dora build ./dataflow_dynamic.yml) | ||
``` | ||
|
||
It will install the required dependencies for the Python nodes. | ||
|
||
Then you can run the dataflow: | ||
|
||
```bash | ||
dora up | ||
dora start ./dataflow.yml (or dora start ./dataflow_dynamic.yml) | ||
``` | ||
|
||
**Note**: if you're running the dynamic dataflow, you will need to start manually the ultralytics-yolo node: | ||
|
||
```bash | ||
# activate your virtual environment in another terminal | ||
python opencv-plot --name plot | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
nodes: | ||
- id: dora-microphone | ||
build: pip install -e ../../node-hub/dora-microphone | ||
path: dora-microphone | ||
outputs: | ||
- audio | ||
|
||
- id: dora-distil-whisper | ||
build: pip install -e ../../node-hub/dora-distil-whisper | ||
path: dora-distil-whisper | ||
inputs: | ||
input: dora-microphone/audio | ||
outputs: | ||
- text | ||
|
||
- id: terminal-print | ||
build: cargo build -p terminal-print | ||
path: dynamic | ||
inputs: | ||
text: dora-distil-whisper/text |