- "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.
model_max_length: int | None
model_max_length: int | None= None The maximum number of tokens for the model. If the token count exceeds this, the counter will turn red. If not provided, the component will try to detect it from the loaded tokenizer.
preview_tokens: bool
preview_tokens: bool= False If True, the component displays the formatted tokens.
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
changeTriggered 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
inputThis listener is triggered when the user changes the value of the TokenizerTextBox.
submit
submitThis listener is triggered when the user presses the Enter key while the TokenizerTextBox is focused.
blur
blurThis listener is triggered when the TokenizerTextBox is unfocused/blurred.
select
selectEvent 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