Streamlit wrapper for Cognite Reveal to view 3D content from Cognite Data Fsion
Project description
Cognite 3D Reveal Streamlit
This is a Streamlit library that can be used to show 3D models inside a Streamlit app. It works especially good when used inside Streamlit in Fusion, but can also be used in standalone Streamlit apps.
How to install
You simply install it by running
pip install cognite-streamlit-reveal
How to use
Here is an example app
import streamlit as st
import os
from cognite.streamlit import reveal
from cognite.client import CogniteClient
st.subheader("Cognite Reveal Streamlit example")
client = CogniteClient()
model_id = 123
revision_id = 234
selected_node_id = reveal(client, model_id, revision_id)
st.markdown("Selected node id: %d!" % int(selected_node_id))
Local development
It's recommended to add a clean environment. You need pip
and node
.
Clone repo
git clone https://github.com/cognitedata/streamlit-cognite-reveal.git
Install Python packages
pip install streamlit
pip install cognite-sdk
Install NPM packages and start server
cd reveal/frontend
yarn
HTTPS=true yarn start
Then open https://localhost:3001/ to accept bad certificate.
Open repo folder in another terminal. Install this package as development package
pip install -e .
Extract a token from Fusion, and start with
COGNITE_TOKEN="TOKEN" streamlit run examples/demo.py
Local development in fusion stlite
Make sure you have set (reveal/init.py:8)[reveal/init.py:8] to _RELEASE = True
.
Step 1) Build front end component with cd reveal/frontend && yarn && yarn build
Step 2) Build streamlit component with python -m build
(hint: pip install build
)
Step 3) Start local server python server.py
Open Fusion, create a Streamlit app and add the following the installed package
http://localhost:8000/dist/reveal_streamlit_component-0.0.1-py3-none-any.whl
It will then load successfully inside Stlite.
Building a release version
In order to build a packaged release version, follow steps:
Set the 'RELEASE' environment variable to indicate to build system that
you are building a release version:
export RELEASE=1
steps to actually build the package
Project details
Release history Release notifications | RSS feed
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 streamlit_cognite_reveal-0.0.5.tar.gz
.
File metadata
- Download URL: streamlit_cognite_reveal-0.0.5.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1e513947c5548f61abaa1121d3358dcf04990d05114cc7fb1aea8b8f19c350 |
|
MD5 | 92a1c929242443def1195eb2b66bd182 |
|
BLAKE2b-256 | 7e648ff6c9e3eac8ad041afe171a69e4151edc7601e7c8e0e4e681668ae64d09 |
File details
Details for the file streamlit_cognite_reveal-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: streamlit_cognite_reveal-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 600cb26f646ebcdeb8c61417f6da3ff68175f98cfbe873ad4271687eb811c90c |
|
MD5 | 8dca2d3457d39142d0d03e6ed8fc9aca |
|
BLAKE2b-256 | 93ca2c4281fa5bcd7bd7ed5a941f65d090e8e2b8b619b2721440668e70d02098 |