I am trying to implement a streamlit component with a viewer already prebuilt seemingly from
Is there a way or advice on how to integrate this into a component through React or Typescript? Without missing definitions (see screenshot below). I am aware that I need to create some object for some definitions to exist, but more about the
'X' is not defined
# __init__.py import streamlit.components.v1 as components ... def my_component(var1, var2, key=None): component.html("<script src='<SCRIPT_LOCAL_TO_COMPONENT>'>...</script>")
This would be the simplest way to get the application working, or is there a way to use the provided
index.js wrapper for
glvis.js into the frontend component from
glvis-js that may not conflict with the internals? Here is the
initial conversation I started.
Any advice or direction would be greatly appreciated.
- Streamlit version: 0.81.1
- Python version: 3.7.10
- OS version: macOS High Sierra
- Browser version: Firefox 88.0
From github from Fanilo
Since this is more of a Streamlit usage question, you will get a bit more answers on the forum, especially if it’s about creating new components/visualizers in Streamlit, we’re always on the lookout for those!
Now regarding your question (we can go into detail on the forum ), I haven’t tested this is still intuition but if you’re trying the
def my_component(var1, var2, key=None): component.html("<script src='<SCRIPT_LOCAL_TO_COMPONENT>'>...</script>")
method, my guess is
SCRIPT_LOCAL_TO_COMPONENTwill need to be in Streamlit’s static folder (which you can find with
python -c "import streamlit as st; print(st.__path__), check out this answer for a bit more detail).
Another way would be to read the entire
glviz.jsin Python and then pasting the content inside the
<script>tag in the
PS. Thanks Fanilo