Skip to main content

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/hackathon-reveal-streamlit.git

Install Python packages pip install streamlit

Install NPM packages and start server

cd cognite/streamlit/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/example.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.

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 andeplane_reveal_streamlit_component-0.1.5.tar.gz.

File metadata

File hashes

Hashes for andeplane_reveal_streamlit_component-0.1.5.tar.gz
Algorithm Hash digest
SHA256 dda3fa430e516c568330d295a9353eb5bbdf5da04b6b593c33bff29469005471
MD5 a192aa8eaaf34f728c41295143b4fa23
BLAKE2b-256 cc36fd4ed5ffa6ebafc4837205b11e1d5c8c083179e0a0de5be529449bb97f32

See more details on using hashes here.

File details

Details for the file andeplane_reveal_streamlit_component-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for andeplane_reveal_streamlit_component-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cd00f671303e0405a911657514da37686131c2d7e39ea4f5e0b3e5ca281add46
MD5 5308cb2ec1aa6740919031333e997a13
BLAKE2b-256 68ed29044ac7b615ade9260310c13781f6a5a83ba8bd470b0e294e2dd6e75a49

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page