Skip to content

Commit

Permalink
Add README section for rerun within the dataflow
Browse files Browse the repository at this point in the history
  • Loading branch information
haixuanTao committed Oct 13, 2024
1 parent 3c43f8c commit 9133406
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/camera/dataflow_rerun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
nodes:
- id: camera
build: pip install ../../node-hub/opencv-video-capture
path: opencv-video-capture
inputs:
tick: dora/timer/millis/20
outputs:
- image
env:
CAPTURE_PATH: 0
IMAGE_WIDTH: 640
IMAGE_HEIGHT: 480

- id: plot
build: cargo build -p dora-rerun --release
path: dora-rerun
inputs:
image:
source: camera/image
queue_size: 1
env:
IMAGE_WIDTH: 640
IMAGE_HEIGHT: 480
README: |
# Visualization of your webcam
- You can increase or decrease the frequency within the dataflow with: `tick: dora/timer/millis/20` in the webcam node.
43 changes: 43 additions & 0 deletions examples/vlm/dataflow_rerun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
nodes:
- id: camera
build: pip install -e ../../node-hub/opencv-video-capture
path: opencv-video-capture
inputs:
tick: dora/timer/millis/20
outputs:
- image
env:
CAPTURE_PATH: 0
IMAGE_WIDTH: 640
IMAGE_HEIGHT: 480

- id: dora-qwenvl
build: pip install -e ../../node-hub/dora-qwenvl
path: dora-qwenvl
inputs:
image:
source: camera/image
queue_size: 1
tick: dora/timer/millis/200
outputs:
- text
- tick
env:
DEFAULT_QUESTION: Describe the image.

- id: plot
build: cargo build -p dora-rerun --release
path: dora-rerun
inputs:
image:
source: camera/image
queue_size: 1
text: dora-qwenvl/tick
env:
IMAGE_WIDTH: 640
IMAGE_HEIGHT: 480
README: |
# Visualization of your webcam
- You can increase or decrease the frequency within the dataflow with: `tick: dora/timer/millis/20` in the webcam node.
- You can change the model prompt within the dataflow with: `DEFAULT_QUESTION: Describe the image.`
14 changes: 14 additions & 0 deletions node-hub/dora-rerun/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ fn main() -> Result<()> {
.spawn_opts(&options, None)
.context("Could not spawn rerun visualization")?;

match std::env::var("README") {
Ok(readme) => {
readme
.parse::<String>()
.context("Could not parse readme value")?;
rec.log("README", &rerun::TextDocument::new(readme))
.wrap_err("Could not log text")?;
}
Err(VarError::NotUnicode(_)) => {
return Err(eyre!("readme env variable is not unicode"));
}
Err(VarError::NotPresent) => (),
};

while let Some(event) = events.recv() {
if let Event::Input { id, data, metadata } = event {
if id.as_str().contains("image") {
Expand Down

0 comments on commit 9133406

Please sign in to comment.