- "text": "Gradio is an awesome tool for building ML demos!",
- "tokens": [],
- "token_ids": []
value: typing.Union[str, dict, typing.Callable, NoneType][
str, dict, Callable, None
]
value: typing.Union[str, dict, typing.Callable, NoneType][
str, dict, Callable, None
]
= None
The initial value. Can be a string to initialize the text, or a dictionary for full state. If a function is provided, it will be called when the app loads to set the initial value.
model: str
model: str
= "Xenova/gpt-3"
The name of a Hugging Face tokenizer to use (must be compatible with Transformers.js). Defaults to "Xenova/gpt-2".
display_mode: "text" | "token_ids" | "hidden"
display_mode: "text" | "token_ids" | "hidden"
= "text"
Controls the content of the token visualization panel. Can be 'text' (default), 'token_ids', or 'hidden'.
hide_input: bool
hide_input: bool
= False
If True, the component's own textbox is hidden, turning it into a read-only visualizer. Defaults to False.
lines: int
lines: int
= 2
The minimum number of line rows for the textarea.
max_lines: int | None
max_lines: int | None
= None
The maximum number of line rows for the textarea.
placeholder: str | None
placeholder: str | None
= None
A placeholder hint to display in the textarea when it is empty.
autofocus: bool
autofocus: bool
= False
If True, will focus on the textbox when the page loads.
autoscroll: bool
autoscroll: bool
= True
If True, will automatically scroll to the bottom of the textbox when the value changes.
text_align: typing.Optional[typing.Literal["left", "right"]][
"left" | "right", None
]
text_align: typing.Optional[typing.Literal["left", "right"]][
"left" | "right", None
]
= None
How to align the text in the textbox, can be: "left" or "right".
rtl: bool
rtl: bool
= False
If True, sets the direction of the text to right-to-left.
show_copy_button: bool
show_copy_button: bool
= False
If True, a copy button will be shown.
max_length: int | None
max_length: int | None
= None
The maximum number of characters allowed in the textbox.
label: str | None
label: str | None
= None
The label for this component, displayed above the component.
info: str | None
info: str | None
= None
Additional component description, displayed below the label.
every: float | None
every: float | None
= None
If `value` is a callable, this sets a timer to run the function repeatedly.
show_label: bool
show_label: bool
= True
If False, the label is not displayed.
container: bool
container: bool
= True
If False, the component will not be wrapped in a container.
scale: int | None
scale: int | None
= None
The relative size of the component compared to others in a `gr.Row` or `gr.Column`.
min_width: int
min_width: int
= 160
The minimum-width of the component in pixels.
interactive: bool | None
interactive: bool | None
= None
If False, the user will not be able to edit the text.
visible: bool
visible: bool
= True
If False, the component will be hidden.
elem_id: str | None
elem_id: str | None
= None
An optional string that is assigned as the id of this component in the HTML DOM.
elem_classes: list[str] | str | None
elem_classes: list[str] | str | None
= None
An optional list of strings that are assigned as the classes of this component in the HTML DOM.
change
change
Triggered when the value of the TokenizerTextBox 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
input
This listener is triggered when the user changes the value of the TokenizerTextBox.
submit
submit
This listener is triggered when the user presses the Enter key while the TokenizerTextBox is focused.
blur
blur
This listener is triggered when the TokenizerTextBox is unfocused/blurred.
select
select
Event listener for when the user selects or deselects the TokenizerTextBox. Uses event data gradio.SelectData to carry `value` referring to the label of the TokenizerTextBox, and `selected` to refer to state of the TokenizerTextBox. See EventData documentation on how to use this event data