st-annotated-text


Namest-annotated-text JSON
Version 4.0.2 PyPI version JSON
download
home_pagehttps://github.com/tvst/st-annotated-text
SummaryA simple component to display annotated text in Streamlit apps.
upload_time2025-01-23 15:09:02
maintainerNone
docs_urlNone
authorThiago Teixeira
requires_python>=3.5
licenseApache 2
keywords
VCS
bugtrack_url
requirements streamlit htbuilder
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Annotated Text Component for Streamlit

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

![Example image](https://github.com/tvst/st-annotated-text/raw/master/example.png)

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

[![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://st-annotated-text.streamlit.app/)


## Installation

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

```bash
pip install streamlit
pip install st-annotated-text
```


## Example

```python
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](https://st-annotated-text.streamlit.app).


## Parameters

The `annotated_text()` function accepts any number of the following arguments:
- strings, to draw the string as-is on the screen.
- tuples of the form (main_text, annotation_text, background, color) where
  background and foreground colors are optional and should be an CSS-valid string such as
  "#aabbcc" or "rgb(10, 20, 30)"
- [htbuilder.HtmlElement](https://github.com/tvst/htbuilder) objects in case you want to customize
  the annotations further. In particular, you can import the `annotation()` function from this
  module to easily produce annotations whose CSS you can customize via keyword arguments.
- lists of any of the above -- or of lists!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tvst/st-annotated-text",
    "name": "st-annotated-text",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": null,
    "author": "Thiago Teixeira",
    "author_email": "me@thiagot.com",
    "download_url": "https://files.pythonhosted.org/packages/4d/76/c0f64a56b779bfb5c87437687a9970d12dad37b5aea2541823d0c5010818/st_annotated_text-4.0.2.tar.gz",
    "platform": null,
    "description": "# Annotated Text Component for Streamlit\n\nA simple component to display annotated text in Streamlit apps. For example:\n\n![Example image](https://github.com/tvst/st-annotated-text/raw/master/example.png)\n\nOr, even better, check out our demo app here:\n\n[![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://st-annotated-text.streamlit.app/)\n\n\n## Installation\n\nFirst install Streamlit (of course!) then pip-install this library:\n\n```bash\npip install streamlit\npip install st-annotated-text\n```\n\n\n## Example\n\n```python\nimport streamlit as st\nfrom annotated_text import annotated_text\n\nannotated_text(\n    \"This \",\n    (\"is\", \"verb\"),\n    \" some \",\n    (\"annotated\", \"adj\"),\n    (\"text\", \"noun\"),\n    \" for those of \",\n    (\"you\", \"pronoun\"),\n    \" who \",\n    (\"like\", \"verb\"),\n    \" this sort of \",\n    (\"thing\", \"noun\"),\n    \".\"\n)\n```\n\nFor more examples, including :sparkles:**customization options**:sparkles:, see\n[the demo app](https://st-annotated-text.streamlit.app).\n\n\n## Parameters\n\nThe `annotated_text()` function accepts any number of the following arguments:\n- strings, to draw the string as-is on the screen.\n- tuples of the form (main_text, annotation_text, background, color) where\n  background and foreground colors are optional and should be an CSS-valid string such as\n  \"#aabbcc\" or \"rgb(10, 20, 30)\"\n- [htbuilder.HtmlElement](https://github.com/tvst/htbuilder) objects in case you want to customize\n  the annotations further. In particular, you can import the `annotation()` function from this\n  module to easily produce annotations whose CSS you can customize via keyword arguments.\n- lists of any of the above -- or of lists!\n",
    "bugtrack_url": null,
    "license": "Apache 2",
    "summary": "A simple component to display annotated text in Streamlit apps.",
    "version": "4.0.2",
    "project_urls": {
        "Homepage": "https://github.com/tvst/st-annotated-text"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d970f29d4359ddfd1a0afa00065e4dac32bd4931f589185f5f0f499db9aee4fe",
                "md5": "1f1a2676358b657f98e25086400044fe",
                "sha256": "712c45821f020eccafad3a58c10b9d2d51d449f4db999a06308ecf39a753a4df"
            },
            "downloads": -1,
            "filename": "st_annotated_text-4.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f1a2676358b657f98e25086400044fe",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 9084,
            "upload_time": "2025-01-23T15:09:00",
            "upload_time_iso_8601": "2025-01-23T15:09:00.863332Z",
            "url": "https://files.pythonhosted.org/packages/d9/70/f29d4359ddfd1a0afa00065e4dac32bd4931f589185f5f0f499db9aee4fe/st_annotated_text-4.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d76c0f64a56b779bfb5c87437687a9970d12dad37b5aea2541823d0c5010818",
                "md5": "2cd58527254cb906919ee629395d6212",
                "sha256": "b0134dcf734697cc3dbdb11862c4174071e7fb6f365af55a37c710d357fd88a5"
            },
            "downloads": -1,
            "filename": "st_annotated_text-4.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "2cd58527254cb906919ee629395d6212",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 7915,
            "upload_time": "2025-01-23T15:09:02",
            "upload_time_iso_8601": "2025-01-23T15:09:02.880274Z",
            "url": "https://files.pythonhosted.org/packages/4d/76/c0f64a56b779bfb5c87437687a9970d12dad37b5aea2541823d0c5010818/st_annotated_text-4.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-23 15:09:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tvst",
    "github_project": "st-annotated-text",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "streamlit",
            "specs": []
        },
        {
            "name": "htbuilder",
            "specs": []
        }
    ],
    "lcname": "st-annotated-text"
}
        
Elapsed time: 0.96291s