Streamlit wrapper of React Cytoscape.js.
pip install streamlit-cytoscapejs
import streamlit as st
from streamlit_cytoscapejs import st_cytoscapejs
elements = [
{"data": {"id": "one", "label": "Node 1"}, "position": {"x": 0, "y": 0}},
{"data": {"id": "two", "label": "Node 2"}, "position": {"x": 100, "y": 0}},
{"data": {"source": "one", "target": "two", "label": "Edge from Node1 to Node2"}},
]
stylesheet = [
{"selector": "node", "style": {"width": 20, "height": 20, "shape": "rectangle"}},
{"selector": "edge", "style": {"width": 10}},
]
st.title("Hello Cytoscape.js")
clicked_elements = st_cytoscapejs(elements, stylesheet)
if clicked_elements is not None:
st.write(clicked_elements)
cd streamlit_cytoscape/frontend
npm install
conda create -n streamlit-cytoscapejs python=3.7
conda activate streamlit-cytoscapejs
pip install -e .
Both webpack dev server and Streamlit should run at the same time.
cd streamlit_cytoscape/frontend
npm run start
streamlit run app.py
I don't plan to make a lot of progress on this for now (except if huge interest) but if you want to contribute/take over its development I'm happy to lend a hand :).
Obviously missing lots of things like: