diff --git a/bindings/streamlit-gpt-vis/README.md b/bindings/streamlit-gpt-vis/README.md index 327b06b..2dbe63f 100644 --- a/bindings/streamlit-gpt-vis/README.md +++ b/bindings/streamlit-gpt-vis/README.md @@ -15,7 +15,7 @@ pip install streamlit-gpt-vis ```python import streamlit as st -from streamlit_gpt_vis import gpt_vis_renderer +from streamlit_gpt_vis import set_gpt_vis content = ''' # GPT-VIS \n\nComponents for GPTs, generative AI, and LLM projects. Not only UI Components. @@ -27,14 +27,14 @@ Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022. \`\`\` ''' -gpt_vis_renderer(content, config=None) +set_gpt_vis(content) ``` ## API -### gpt_vis_renderer(content: str, config: dict = None) +### `set_gpt_vis(content: str, config: dict = None)` -- content: Markdown content +- content:Markdown content - config: GPT-Vis [ConfigProvider](https://github.com/antvis/GPT-Vis/blob/main/src/ConfigProvider/index.md) config ## License diff --git a/bindings/streamlit-gpt-vis/example/basic.py b/bindings/streamlit-gpt-vis/example/basic.py index b5d2642..d93fc88 100644 --- a/bindings/streamlit-gpt-vis/example/basic.py +++ b/bindings/streamlit-gpt-vis/example/basic.py @@ -1,5 +1,5 @@ import streamlit as st -from streamlit_gpt_vis import gpt_vis_renderer +from streamlit_gpt_vis import set_gpt_vis # Add some test code to play with the component while it's in development. # During development, we can run this just as we would any other Streamlit @@ -9,7 +9,7 @@ # Create an instance of our component with a constant `content` arg, and # print its output value. -gpt_vis_renderer(''' +set_gpt_vis(''' # GPT-VIS \n\nComponents for GPTs, generative AI, and LLM projects. Not only UI Components. Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022. You can see a steady increase over the years, with notable *growth* particularly in recent years. @@ -27,7 +27,7 @@ st.subheader("Component with vis text") -gpt_vis_renderer(''' +set_gpt_vis(''' 本月共产生决策数量2,783个,环比增长15.2%高优先级决策占比56.2%,呈现稳定上升趋势,预计下月将突破3,000大关。 ''') @@ -46,4 +46,4 @@ # "content" argument without having it get recreated. content_input = st.text_input("Enter render content", value="#### GPT-VIS \n\n Components for GPTs, generative AI, and LLM projects. Not only UI Components.") -gpt_vis_renderer(content_input, config={'plot': { 'theme': { 'type': 'academy' }}}) +set_gpt_vis(content_input, config={'plot': { 'theme': { 'type': 'academy' }}}) diff --git a/bindings/streamlit-gpt-vis/setup.py b/bindings/streamlit-gpt-vis/setup.py index d0ea14b..457a5e9 100644 --- a/bindings/streamlit-gpt-vis/setup.py +++ b/bindings/streamlit-gpt-vis/setup.py @@ -9,7 +9,7 @@ here = os.path.abspath(os.path.dirname(__file__)) __title__ = "streamlit-gpt-vis" -__version__ = "0.0.1" +__version__ = "0.0.2" this_directory = Path(__file__).parent long_description = (this_directory / "README.md").read_text() diff --git a/bindings/streamlit-gpt-vis/streamlit_gpt_vis/__init__.py b/bindings/streamlit-gpt-vis/streamlit_gpt_vis/__init__.py index 37c3fcc..7196bf9 100644 --- a/bindings/streamlit-gpt-vis/streamlit_gpt_vis/__init__.py +++ b/bindings/streamlit-gpt-vis/streamlit_gpt_vis/__init__.py @@ -23,7 +23,7 @@ # We give the component a simple, descriptive name ("my_component" # does not fit this bill, so please choose something better for your # own component :) - "gpt_vis_renderer", + "set_gpt_vis", # Pass `url` here to tell Streamlit that the component will be served # by the local dev server that you run via `npm run start`. # (This is useful while your component is in development.) @@ -35,7 +35,7 @@ # build directory: parent_dir = os.path.dirname(os.path.abspath(__file__)) build_dir = os.path.join(parent_dir, "frontend/dist") - _component_func = components.declare_component("gpt_vis_renderer", path=build_dir) + _component_func = components.declare_component("set_gpt_vis", path=build_dir) # Create a wrapper function for the component. This is an optional @@ -43,7 +43,7 @@ # `declare_component` and call it done. The wrapper allows us to customize # our component's API: we can pre-process its input args, post-process its # output value, and add a docstring for users. -def gpt_vis_renderer(content, config=None, key=None): +def set_gpt_vis(content, config=None, key=None): """Create a new instance of "my_component". Parameters