- Using Existing Building Blocks
Using Existing Building Blocks
Learn how you can use existing building blocks to create a workflow.
First, please make sure you have signed up for a Sieve account as per the quickstart guide.
Install the Sieve CLI
pip install https://mango.sievedata.com/v1/client_package/sievedata-0.0.1.1.2-py3-none-any.whl
Then, export your Sieve API key as an environment variable. You can find your API key in the Sieve dashboard.
Sieve allows users to reference existing building blocks in their workflows. Below are a few sample building blocks that you can use to create a workflow.
sieve.Video into a stream of
sieve.Image objects with extra metadata such as
fps accessible as
YOLOv5 Object Detector:
Detects objects in an image using YOLOv5. Returns a list of dictionaries with the following keys:
SORT Object Tracker:
Takes a list of boxes in a video and returns a dictionary of “objects” indexed by ID, where each value of the dictionary is a list of boxes for that object.
A page to view all available building blocks is still under development. In the meantime, you can view all available building blocks used in template workflows here or check out models in the examples repository which have all been deployed under the
Create a Workflow
Create a new folder and add the files below.
import sieve from typing import Dict, Tuple from yolo import Yolo from tracker import SORT from splitter import VideoSplitter from visualizer import draw_boxes @sieve.workflow(name="yolo_object_tracking") def yolosplit(video: sieve.Video) -> Dict: images = sieve.reference("sieve-developer/video-splitter")(video) yolo_outputs = sieve.reference("sieve-developer/yolo")(images) return sieve.reference("sieve-developer/sort")(yolo_outputs)
Deploy the Workflow
Create some of the files above in a separate folder. Now go into the folder and run the following command. You can monitor the status via your terminal or on the Sieve dashboard.
Run the Workflow
There are many ways to trigger the workflow. See this section for more details.