Objective
This document demonstrates how Streamlit, a lightweight Python-based web framework, can be used to create a user-friendly interface for triggering Cognite Data Fusion (CDF) workflows - including:
- Image/File Ingestion
- Ad-hoc Workflow Execution
- Metadata tagging and status handling
Such solutions allow non-technical users (e.g., engineers, operators) to initiate sophisticated data operations without writing code -increasing accessibility, automation, and operational agility.
Architecture Overview
[User] → [Streamlit UI] → [CDF SDK/API] → [Files, Workflows, Datasets, Metadata]
- Ingestion: Upload images to Cognite File storage with metadata.
- Transformation/Processing: Trigger workflows (e.g., YOLO object detection, anomaly detection).
- Visualization & Logging: Provide real-time feedback and results to users.
Streamlit UI Features
- File Upload to Cognite
- Accepts multiple image types (jpg, png, etc.)
- Uploads them to Cognite File Storage
- Assigns metadata and associates with a predefined data_set_id
- Handles and displays upload success or failure
client.files.upload_bytes(
name=file_name,
content=file_bytes,
source="streamlit",
external_id=f"streamlit-img-{file_name}",
mime_type=uploaded_file.type,
metadata={"type": "image", "source": "streamlit"},
data_set_id="YOUR_DATASET_ID"
)- Workflow Trigger
- Simple button to run any registered CDF Workflow
- Option to specify version or parameters
- Can be extended to support user-input parameters for dynamic execution
client.workflows.executions.run(workflow_external_id="MainWorkflow", version="3")
Example Use Case: Subsea Image Anomaly Detection
Scenario:
- Field engineer uploads new batch of pipeline inspection images.
- They trigger the MainWorkflow which:
- Ingests the images
- Parses and tags them
- Runs YOLO-based defect detection
- Logs results back to CDF
- Results are visualized in downstream dashboards or reported via alerts.
Benefits
| Feature | Benefit |
|---|---|
| No-code trigger | Enables broader user base to operationalize AI/ML |
| Integrated with CDF | Seamless metadata, logging, traceability |
| Ad-hoc ready | On-demand execution without re-deployment |
| Modular & Reusable | Easily extendable to other workflows |
| Secure & Auditable | CDF SDK ensures enterprise-grade tracking |
How to Extend
- Add parameter inputs to Streamlit (text boxes, dropdowns).
- Visualize execution results (success/failure, tags, bounding boxes).
- Add authentication and user-specific tracking.
- Chain multiple workflows: e.g., QC → Detection → Report Generation.
Summary
Streamlit + CDF = Lightweight Operationalization Layer
This integration pattern is ideal for:
- Image processing
- IoT data snapshots
- AI-driven diagnostics
- Interactive ETL tasks
- Citizen data scientist enablement
It empowers asset teams to convert raw data into insights instantly - closing the loop between field data and digital action.
Check the
documentation
Ask the
Community
Take a look
at
Academy
Cognite
Status
Page
Contact
Cognite Support