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,
max_text_length=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.
max_text_length: int or None
Defaults to None. If set, enables the multi-line functionality and determines the maximum characters the textbox allows. Else, displays the default one-line textbox.
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. If on_submit returns a value, this value will be returned by the component.
"""
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
Release history Release notifications | RSS feed
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.3.tar.gz
(740.4 kB
view details)
Built Distribution
File details
Details for the file streamlit-feedback-0.1.3.tar.gz
.
File metadata
- Download URL: streamlit-feedback-0.1.3.tar.gz
- Upload date:
- Size: 740.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90f198a4e116e901aaf08058261d444f0abcd3a365bac8c5d6fc08a3c05e02a2 |
|
MD5 | 9ecba1504311d63cb3a6d920b7a519ac |
|
BLAKE2b-256 | 882094d10df8e0e5a3cd39df5a564372195b25cdb96b710baef5a39f1b0841a2 |
File details
Details for the file streamlit_feedback-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: streamlit_feedback-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 533082aa7b0978692527a46ef63d520db50be79d43a436baa6c2d11a1d93fe9d |
|
MD5 | 0c4f5fda07d1660b20f5ad24df1e7cfc |
|
BLAKE2b-256 | 23d2209967995e7f85335ccec963603e7f574abed7b4456421e71329074b3bbf |