Python library for easily interacting with trained machine learning models
Project description
tags: [gradio-custom-component, SimpleTextbox] title: gradio_chatagui short_description: A gradio custom component colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py
gradio_chatagui
Python library for easily interacting with trained machine learning models
Installation
pip install gradio_chatagui
Usage
import gradio as gr
from gradio_chatagui import ChatAGUI
example = ChatAGUI().example_value()
demo = gr.Interface(
lambda x:x,
ChatAGUI(), # interactive version of your component
ChatAGUI(), # static version of your component
# examples=[[example]], # uncomment this line to view the "example version" of your component
)
if __name__ == "__main__":
demo.launch()
ChatAGUI
Initialization
| name | type | default | description |
|---|---|---|---|
value |
str | Callable | None
|
None |
Initial value for the component. |
api_root |
str
|
"" |
Root URL for the AG-UI API endpoints. |
initial_thread_id |
str
|
"" |
Initial thread ID for the conversation. |
label |
str | None
|
"AG-UI Chat" |
The label for this component. |
every |
Timer | float | None
|
None |
Continuously calls `value` to recalculate it if `value` is a function. |
inputs |
Component | Sequence[Component] | set[Component] | None
|
None |
Components that are used as inputs to calculate `value`. |
show_label |
bool | None
|
True |
If True, will display label. |
scale |
int | None
|
None |
Relative size compared to adjacent Components. |
min_width |
int
|
160 |
Minimum pixel width. |
interactive |
bool | None
|
None |
If True, will be rendered as editable. |
visible |
bool
|
True |
If False, component will be hidden. |
elem_id |
str | None
|
None |
An optional string assigned as the id of this component. |
elem_classes |
list[str] | str | None
|
None |
An optional list of strings assigned as classes. |
render |
bool
|
True |
If False, component will not be rendered. |
key |
int | str | tuple[int | str, ...] | None
|
None |
Used in gr.render for component identity across re-renders. |
preserved_by_key |
list[str] | str | None
|
"value" |
Parameters preserved across re-renders. |
Events
| name | description |
|---|---|
change |
Triggered when the value of the ChatAGUI changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See .input() for a listener that is only triggered by user input. |
input |
This listener is triggered when the user changes the value of the ChatAGUI. |
submit |
This listener is triggered when the user presses the Enter key while the ChatAGUI is focused. |
User function
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
- When used as an Input, the component only impacts the input signature of the user function.
- When used as an output, the component only impacts the return signature of the user function.
The code snippet below is accurate in cases where the component is used as both an input and an output.
- As output: Is passed, processed message data.
- As input: Should return, value to send to the frontend.
def predict(
value: typing.Optional[typing.Dict][Dict, None]
) -> typing.Union[str, typing.Dict, NoneType][str, Dict, None]:
return value
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gradio_chatagui-0.0.1.tar.gz.
File metadata
- Download URL: gradio_chatagui-0.0.1.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d0e57dda89030a0938076f837cbb346289bb0fd8d5a75805a3764ae90a5cfa0
|
|
| MD5 |
db78b19695ff8d18f6e0c0eac61a4100
|
|
| BLAKE2b-256 |
52a6ed17fa365c970661b9d0accc8ea16c40eb35df2ed8f6d5a0d1dd2fd5481f
|
File details
Details for the file gradio_chatagui-0.0.1-py3-none-any.whl.
File metadata
- Download URL: gradio_chatagui-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b2cc9f25ddca49ff5fb1f1f8ae86d539cbfacbe1d40bbcc26257314f690b3bd
|
|
| MD5 |
9e6d37e1037eb6049fdb121e0e23ffe1
|
|
| BLAKE2b-256 |
395ba0ffb730e9edc366dbf44cce126706fa5e03862b7b736863343d1cbba18b
|