Manage and create Clarifai workflows with yaml files
Project description
yaml2workflow
Clarifai workflows are powerful tools. Building them via the API is a sure way to automate this process, especially if you have many nodes and branches.
Taking inspiration from Kubernetes Helm Charts and AWS Cloud Formation templates, yaml2workflow
is designed to make automating the creation and managing the definition of workflows easier and more transparent.
🙌 Define Workflows as YAML files
Much clearer and more human-readable definitions without distractors. Also, by storing the workflow definitions as a file, you can now use version control for your future automations! Winning.
# A single node workflow
workflow:
id: test-wf-1
nodes:
- id: detector
model:
model_id: face-detection
model_version_id: 45fb9a671625463fa646c3523a3087d5
🙌 Export Workflows as YAML files
[New!] Export your workflows into YAML files as well. Simply pass in the workflow object from a GetWorkflow response. See export_example.py for how to do that.
from yaml2workflow.exporter.workflow import Exporter
with Exporter(response.workflow) as e:
e.parse()
e.export("export_example.yml")
🚀 Installation
Simply enter
pip install yaml2workflow
💪 Usage
- Create a YAML file to define your workflow. Gather the model IDs and model version IDs from Clarifai. See parse_example.yml for a full, filled in template.
- Import the library and use it directly in your code as follows:
from yaml2workflow.parser.workflow import parse
workflows = parse('parse_example.yml', stub=stub, metadata=metadata)
post_workflows_response = stub.PostWorkflows(
service_pb2.PostWorkflowsRequest(
workflows=workflows
),
metadata=metadata
)
See parse_example.py for the full example.
🎉 Done! You've now unlocked more human-readble and more maintable workflows.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file yaml2workflow-0.2.4.tar.gz
.
File metadata
- Download URL: yaml2workflow-0.2.4.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5686627a897c0e8cb460ce2810bb2a27bc287eda2bffaad1077fe6fa2236937 |
|
MD5 | 9d574ca965d4c4d57a93c586454373fa |
|
BLAKE2b-256 | f47af0cad4f139ec407ce768eff3a7d370d7cef06a5a60ea417d6d7893e04c15 |
File details
Details for the file yaml2workflow-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: yaml2workflow-0.2.4-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01131c34e6ef43d696d055b4b8e9f812d1e2a4db481155b919c0fe0d302fa5a5 |
|
MD5 | 8994882009a4c0a4a3c6b85b7debdd2b |
|
BLAKE2b-256 | 541fee7e3b971b2a12382aa1d39a2ff1ccb92db1af9b58a2f5773cf32d394133 |