Skip to main content

Streamlit component that allows you to collect user feedback in your apps

Project description

streamlit-feedback

Here is a Streamlit component that allows you to collect user feedback in your apps.

Install

pip install streamlit-feedback

Examples

  • Trubrics, enabling AI teams to collect, analyse and manage user feedback on their models:

    • LLM Chat Completion: A chatbot that queries OpenAI's API and allows users to leave feedback.
    • LLM Completion: An LLM app that queries OpenAI's API and allows users to leave feedback on single text generations.
  • Raise a PR with your cool feedback example here!

Usage

This component holds a single function:

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(feedback_type="thumbs")
feedback

It can be used with these parameters:

def streamlit_feedback(
    feedback_type,
    optional_text_label=None,
    disable_with_score=None,
    on_submit=None,
    args=(),
    kwargs={},
    align="flex-end",
    key=None,
):
    """Create a new instance of "streamlit_feedback".

    Parameters
    ----------
    feedback_type: str
        The type of feedback; "thumbs" or "faces".
    optional_text_label: str or None
        An optional label to add as a placeholder to the textbox.
        If None, the "thumbs" or "faces" will not be accompanied by textual feedback.
    disable_with_score: str
        An optional score to disable the component. Must be a "thumbs" emoji or a "faces" emoji. Can be used to pass state from one component to another.
    on_submit: callable
        An optional callback invoked when feedback is submitted. This function must accept at least one argument, the feedback response dict,
        allowing you to save the feedback to a database for example. Additional arguments can be specified using `args` and `kwargs`.
    args: tuple
        Additional positional arguments to pass to `on_submit`.
    kwargs: dict
        Additional keyword arguments to pass to `on_submit`.
    align: str
        Where to align the feedback component; "flex-end", "center" or "flex-start".
    key: str or None
        An optional key that uniquely identifies this component. If this is
        None, and the component's arguments are changed, the component will
        be re-mounted in the Streamlit frontend and lose its current state.

    Returns
    -------
    dict
        The user response, with the feedback_type, score and text fields.

    """

For various code examples, see here.

Here are some more examples:

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(
    feedback_type="thumbs",
    optional_text_label="[Optional] Please provide an explanation",
)
feedback

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(feedback_type="faces")
feedback

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(
    feedback_type="faces",
    optional_text_label="[Optional] Please provide an explanation",
)
feedback

from streamlit_feedback import streamlit_feedback
feedback = streamlit_feedback(feedback_type="thumbs", align="flex-start")
feedback

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit-feedback-0.1.0.tar.gz (633.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_feedback-0.1.0-py3-none-any.whl (4.3 MB view details)

Uploaded Python 3

File details

Details for the file streamlit-feedback-0.1.0.tar.gz.

File metadata

  • Download URL: streamlit-feedback-0.1.0.tar.gz
  • Upload date:
  • Size: 633.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for streamlit-feedback-0.1.0.tar.gz
Algorithm Hash digest
SHA256 71b7c4e8ee834dd5fb1dc3808bb413736019fdf4d8e4afee982e050dce9361e6
MD5 d5a082702b1d10600d52976ef58ec17f
BLAKE2b-256 72a9e9827b5aa0fece0254cb1312638252921d1d1e634e218f9db9ddd1896d50

See more details on using hashes here.

File details

Details for the file streamlit_feedback-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_feedback-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ebd0fbb0039d0a18561bba6583876b63c27e0f63b2dba4c3a830bd196a30d4a
MD5 98b0987a6a3c33cd9fba3cb765d7ebf3
BLAKE2b-256 c38dbd6ee66aa018cdf46ebda20d9a683eff6ca7d84bd4146c127093b5591f09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page