-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Miguel A. Cabrera Minagorri <devgorri@gmail.com>
- Loading branch information
Showing
2 changed files
with
22 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,3 @@ | ||
# Pass custom data between stages | ||
|
||
Check [this guide](https://www.pipeless.ai/docs/v1/examples/custom-data) to run the example step by step. |
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,19 @@ | ||
def hook(frame_data, _): | ||
# Add data to the frame that you can later recover from hooks of subsequent stages. You can also recover it from subsequent hooks of the same stage. | ||
# You can use any kind of data. | ||
# Integers: frame_data['user_data'] = 100 | ||
# Floats: frame_data['user_data'] = 100.5 | ||
# Strings: frame_data['user_data'] = "Hello!" | ||
# Heterogeneus arrays: frame_data['user_data'] = ["string", 13, 34.6] | ||
# Heterogeneus Dictionaries (IMPORTANT: all keys must be strings): | ||
frame_data['user_data'] = { | ||
"key1": 0, | ||
"key2": [1, "3"], | ||
"key3": { "inner1": "hola" } | ||
} | ||
|
||
# In a later hook you can obtain the data like: | ||
# my_data = frame_data['user_data'] | ||
|
||
# To connect stages simply give the list to Pipeless when adding a stream: | ||
# pipeless add stream --input-uri "file:///home/user/my/path.mp4" --output-uri "screen" --frame-path "stage1,stage2" |