tvst / st-annotated-text

A simple component to display annotated text in Streamlit apps.
Apache License 2.0
525 stars 41 forks source link

Annotated Text Component for Streamlit

A simple component to display annotated text in Streamlit apps. For example:

Example image

Or, even better, check out our demo app here:

Open in Streamlit

Installation

First install Streamlit (of course!) then pip-install this library:

pip install streamlit
pip install st-annotated-text

Example

import streamlit as st
from annotated_text import annotated_text

annotated_text(
    "This ",
    ("is", "verb"),
    " some ",
    ("annotated", "adj"),
    ("text", "noun"),
    " for those of ",
    ("you", "pronoun"),
    " who ",
    ("like", "verb"),
    " this sort of ",
    ("thing", "noun"),
    "."
)

For more examples, including :sparkles:customization options:sparkles:, see the demo app.

Parameters

The annotated_text() function accepts any number of the following arguments: