text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 189
values | source_page_title stringclasses 189
values |
|---|---|---|---|
ype | None
default `= None`
If the wandb module is provided, will integrate with it and appear on WandB
dashboard
mlflow: ModuleType | None
default `= None`
If the mlflow module is provided, will integrate with the experiment and
appear on ML Flow dashboard
| integrate | https://gradio.app/docs/gradio/interface#interface-queue | Gradio - Interface#Interface Queue Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | queue | https://gradio.app/docs/gradio/interface#interface-queue | Gradio - Interface#Interface Queue Docs |
!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%2... | queue | https://gradio.app/docs/gradio/interface#interface-queue | Gradio - Interface#Interface Queue Docs |
ro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318.3L391.3%20319.9C381%... | queue | https://gradio.app/docs/gradio/interface#interface-queue | Gradio - Interface#Interface Queue Docs |
send status at regular intervals set by this
parameter as the number of seconds.
api_open: bool | None
default `= None`
If True, the REST routes of the backend will be open, allowing requests made
directly to those endpoints to skip the queue.
max_size: int | None
default `= None`
T... | queue | https://gradio.app/docs/gradio/interface#interface-queue | Gradio - Interface#Interface Queue Docs |
Creates a textarea for user to enter string input or display string output.
| Description | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
**Using Textbox as an input component.**
How Textbox will pass its value to your function:
Type: `str | None`
Passes text value as a `str` into the function.
Example Code
import gradio as gr
def predict(
value: str | None
):
process value from... | Behavior | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Parameters ▼
value: str | I18nData | Callable | None
default `= None`
text to show in textbox. If a function is provided, the function will be
called each time the app loads to set the initial value of this component.
type: Literal['text', 'password', 'email']
default `= "text"`
The ... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
e regular interval for the reset Timer.
inputs: Component | list[Component] | set[Component] | None
default `= None`
components that are used as inputs to calculate `value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
show_labe... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
targeting CSS styles.
autofocus: bool
default `= False`
If True, will focus on the textbox when the page loads. Use this carefully, as
it can cause usability issues for sighted and non-sighted users.
autoscroll: bool
default `= True`
If True, will automatically scroll to the bottom o... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
True. Can only be changed if `type` is "text".
rtl: bool
default `= False`
If True and `type` is "text", sets the direction of the text to right-to-left
(cursor appears on the left of the text). Default is False, which renders
cursor on the right.
buttons: list[Literal['copy'] | Button... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
InputHTMLAttributes(autocorrect="off", spellcheck=False) to disable
autocorrect and spellcheck.
| Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Shortcuts
gradio.Textbox
Interface String Shortcut `"textbox"`
Initialization Uses default values
gradio.TextArea
Interface String Shortcut `"textarea"`
Initialization Uses lines=7
| Shortcuts | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Multi-line text input
By default, `gr.Textbox` renders as a single-line input. For longer text such
as paragraphs or code, set `lines` to show multiple rows and optionally
`max_lines` to cap the height:
import gradio as gr
def summarize(text):
return f"Received {len(text.split())} words... | Common Patterns | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
hello_worlddiff_textssentence_builder
| Demos | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Textbox component supports the followin... | Event Listeners | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
t data gradio.CopyData to carry information about the copied content. See
EventData documentation on how to use this event data
Event Parameters
Parameters ▼
fn: Callable | None | Literal['decorator']
default `= "decorator"`
the function to call when this event is triggered. Often a machine learning... | Event Listeners | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
True, will scroll to output component on completion
show_progress: Literal['full', 'minimal', 'hidden']
default `= "full"`
how to show the progress animation while event is running: "full" shows a
spinner which covers the output component area as well as a runtime display in
the upper right corner, "m... | Event Listeners | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
ent data before returning 'fn'
output to the browser.
cancels: dict[str, Any] | list[dict[str, Any]] | None
default `= None`
A list of other events to cancel when this listener is triggered. For example,
setting cancels=[click_event] will cancel the click_event, where click_event
is the return value o... | Event Listeners | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
oncurrency_limit.
api_visibility: Literal['public', 'private', 'undocumented']
default `= "public"`
controls the visibility and accessibility of this endpoint. Can be "public"
(shown in API docs and callable by clients), "private" (hidden from API docs
and not callable by the Gradio client libraries),... | Event Listeners | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Creates a dropdown of choices from which a single entry or multiple entries
can be selected (as an input component) or displayed (as an output component).
| Description | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
**Using Dropdown as an input component.**
How Dropdown will pass its value to your function:
Type: `str | int | float | list[str | int | float] | list[int | None] | None`
Passes the value of the selected dropdown choice as a `str | int | float` or its index as an `int` into the function, depending on `type`. Or, if ... | Behavior | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Parameters ▼
choices: list[str | int | float | tuple[str | I18nData, str | int | float]] | None
default `= None`
a list of string or numeric options to choose from. An option can also be a
tuple of the form (name, value), where name is the displayed name of the
dropdown choice and value is the value t... | Initialization | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
component if `show_label` is
`True` and is also used as the header if there are a table of examples for
this component. If None and used in a `gr.Interface`, the label will be the
name of the parameter this component corresponds to.
info: str | I18nData | None
default `= None`
additional component des... | Initialization | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
default `= None`
if True, choices in this dropdown will be selectable; if False, selection will
be disabled. If not provided, this is inferred based on whether the component
is used as an input or output.
visible: bool | Literal['hidden']
default `= True`
If False, component will be hidden. If "hidd... | Initialization | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Shortcuts
gradio.Dropdown
Interface String Shortcut `"dropdown"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
sentence_builder
| Demos | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Dropdown component supports the followi... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
he function corresponds to one
input component, and the function should return a single value or a tuple of
values, with each element in the tuple corresponding to one output component.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= N... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
no progress animation at all
show_progress_on: Component | list[Component] | None
default `= None`
Component or list of components to show the progress animation on. If None,
will show the progress animation on all of the output components.
queue: bool
default `= True`
If True, will... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
e
not yet run (or generators that are iterating) will be cancelled, but
functions that are currently running will be allowed to finish.
trigger_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.change()`) would not allow any
submissions... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
by clients and via gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event li... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
The gr.UndoData class is a subclass of gr.Event data that specifically
carries information about the `.undo()` event. When gr.UndoData is added as a
type hint to an argument of an event listener method, a gr.UndoData object
will automatically be passed as the value of that argument. The attributes of
this object contai... | Description | https://gradio.app/docs/gradio/undodata | Gradio - Undodata Docs |
import gradio as gr
def undo(retry_data: gr.UndoData, history: list[gr.MessageDict]):
history_up_to_retry = history[:retry_data.index]
return history_up_to_retry
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
chatbot.undo(undo, chatbot, chatbot)
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/undodata | Gradio - Undodata Docs |
Parameters ▼
index: int | tuple[int, int]
The index of the user message that should be undone.
value: Any
The value of the user message that should be undone.
| Attributes | https://gradio.app/docs/gradio/undodata | Gradio - Undodata Docs |
Creates a file explorer component that allows users to browse files on the
machine hosting the Gradio app. As an input component, it also allows users to
select files to be used as input to a function, while as an output component,
it displays selected files.
| Description | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
**Using FileExplorer as an input component.**
How FileExplorer will pass its value to your function:
Type: `list[str] | str | None`
Passes the selected file or directory as a `str` path (relative to `root`) or
`list[str}` depending on `file_count`
Example Code
import gradio as gr
... | Behavior | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Parameters ▼
glob: str
default `= "**/*"`
The glob-style pattern used to select which files to display, e.g. "*" to
match all files, "*.png" to match all .png files, "**/*.txt" to match any .txt
file in any subdirectory, etc. The default value matches all files and folders
recursively. See the Python ... | Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
onent. If None and
used in a `gr.Interface`, the label will be the name of the parameter this
component is assigned to.
every: Timer | float | None
default `= None`
Continuously calls `value` to recalculate it if `value` is a function (has no
effect otherwise). Can provide a Timer whose tick resets `v... | Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
min_height: int | str | None
default `= None`
interactive: bool | None
default `= None`
if True, will allow users to select file(s); if False, will only display
files. If not provided, this is inferred based on whether the component is
used as an input or output.
visi... | Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
buttons: list[Button] | None
default `= None`
A list of gr.Button() instances to show in the top right corner of the
component. Custom buttons will appear in the toolbar with their configured
icon and/or label, and clicking them will trigger any .click() events
registered on the button.
| Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Shortcuts
gradio.FileExplorer
Interface String Shortcut `"fileexplorer"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The FileExplorer component supports the fol... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
text] | None
default `= None`
List of gradio.components to use as inputs. If the function takes no inputs,
this should be an empty list.
outputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outp... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
lt `= True`
If True, will place the request on the queue, if the queue has been enabled.
If False, will not put this event on the queue, even if the queue has been
enabled. If None, will use the queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
not allow any
submissions while an event is pending. If set to "multiple", unlimited
submissions are allowed while pending, and "always_last" (default for
`.change()` and `.key_up()` events) would allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= ... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
ique key for this event listener to be used in @gr.render(). If set, this
value identifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be exe... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Group is a layout element within Blocks which groups together children so
that they do not have any padding or margin between them.
| Description | https://gradio.app/docs/gradio/group | Gradio - Group Docs |
with gr.Group():
gr.Textbox(label="First")
gr.Textbox(label="Last")
| Example Usage | https://gradio.app/docs/gradio/group | Gradio - Group Docs |
Parameters ▼
visible: bool | Literal['hidden']
default `= True`
If False, group will be hidden.
elem_id: str | None
default `= None`
An optional string that is assigned as the id of this component in the HTML
DOM. Can be used for targeting CSS styles.
elem_classes: li... | Initialization | https://gradio.app/docs/gradio/group | Gradio - Group Docs |
A Gradio request object that can be used to access the request headers,
cookies, query parameters and other information about the request from within
the prediction function. The class is a thin wrapper around the
fastapi.Request class. Attributes of this class include: `headers`, `client`,
`query_params`, `session_has... | Description | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
import gradio as gr
def echo(text, request: gr.Request):
if request:
print("Request headers dictionary:", request.headers)
print("IP address:", request.client.host)
print("Query parameters:", dict(request.query_params))
print("Session hash:", request.session_h... | Example Usage | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
Parameters ▼
request: fastapi.Request | None
default `= None`
A fastapi.Request
username: str | None
default `= None`
The username of the logged in user (if auth is enabled)
session_hash: str | None
default `= None`
The session hash of the current session. It is uni... | Initialization | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
request_ip_headers
| Demos | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
Creates an image component that can be used to upload images (as an input)
or display images (as an output).
| Description | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
**Using SimpleImage as an input component.**
How SimpleImage will pass its value to your function:
Type: `str | None`
A `str` containing the path to the image.
Example Code
import gradio as gr
def predict(
value: str | None
):
process value fr... | Behavior | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Parameters ▼
value: str | None
default `= None`
A path or URL for the default value that SimpleImage component is going to
take. If a function is provided, the function will be called each time the app
loads to set the initial value of this component.
label: str | I18nData | None
defa... | Initialization | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
ill_height=True.
min_width: int
default `= 160`
minimum pixel width, will wrap if not sufficient screen space to satisfy this
value. If a certain scale value results in this Component being narrower than
min_width, the min_width parameter will be respected first.
interactive: bool | No... | Initialization | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
t is re-rendered with the same key, these (and only
these) parameters will be preserved in the UI (if they have been changed by
the user or an event listener) instead of re-rendered based on the values
provided during constructor.
| Initialization | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Shortcuts
gradio.SimpleImage
Interface String Shortcut `"simpleimage"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The SimpleImage component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or ... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should accept a list of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*require... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
d allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run before running 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()... | Event Listeners | https://gradio.app/docs/gradio/simpleimage | Gradio - Simpleimage Docs |
Creates a slider that ranges from `minimum` to `maximum` with a step size
of `step`.
| Description | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
**Using Slider as an input component.**
How Slider will pass its value to your function:
Type: `float`
Passes slider value as a `float` into the function.
Example Code
import gradio as gr
def predict(
value: float
):
process value from the Sli... | Behavior | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Parameters ▼
minimum: float
default `= 0`
minimum value for slider. When used as an input, if a user provides a smaller
value, a gr.Error exception is raised by the backend.
maximum: float
default `= 100`
maximum value for slider. When used as an input, if a user provides a larger
va... | Initialization | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
used as inputs to calculate `value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
show_label: bool | None
default `= None`
if True, will display label.
container: bool
default `= True`
If True, will place the component in a co... | Initialization | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
render: bool
default `= True`
If False, component will not render be rendered in the Blocks context. Should
be used if the intention is to assign event listeners now but render the
component later.
key: int | str | tuple[int | str, ...] | None
default `= None`
in a gr.render, Components with ... | Initialization | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Shortcuts
gradio.Slider
Interface String Shortcut `"slider"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Logarithmic scale
Sliders are linear by default. For parameters that vary over several orders of
magnitude (e.g. learning rate), map the slider value inside your function:
import gradio as gr
def train(lr_exp):
lr = 10 ** lr_exp slider value -5 → lr 0.00001
return f"Training wi... | Common Patterns | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
sentence_builderslider_releaseinterface_random_sliderblocks_random_slider
| Demos | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Slider component supports the following... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
| None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the endpoint will be exposed in ... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
ol
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should accept a list of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 out... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
plete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run before running 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
n before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
The gr.RetryData class is a subclass of gr.Event data that specifically
carries information about the `.retry()` event. When gr.RetryData is added as
a type hint to an argument of an event listener method, a gr.RetryData object
will automatically be passed as the value of that argument. The attributes of
this object co... | Description | https://gradio.app/docs/gradio/retrydata | Gradio - Retrydata Docs |
import gradio as gr
def retry(retry_data: gr.RetryData, history: list[gr.MessageDict]):
history_up_to_retry = history[:retry_data.index]
new_response = ""
for token in api.chat_completion(history):
new_response += token
yield history + [new_response]
wit... | Example Usage | https://gradio.app/docs/gradio/retrydata | Gradio - Retrydata Docs |
Parameters ▼
index: int | tuple[int, int]
The index of the user message that should be retried.
value: Any
The value of the user message that should be retried.
[Chatbot Specific Events](../../guides/chatbot-specific-events/)
| Attributes | https://gradio.app/docs/gradio/retrydata | Gradio - Retrydata Docs |
The FileData class is a subclass of the GradioModel class that represents a
file object within a Gradio interface. It is used to store file data and
metadata when a file is uploaded.
| Description | https://gradio.app/docs/gradio/filedata | Gradio - Filedata Docs |
from gradio_client import Client, FileData, handle_file
def get_url_on_server(data: FileData):
print(data['url'])
client = Client("gradio/gif_maker_main", download_files=False)
job = client.submit([handle_file("./cheetah.jpg")], api_name="/predict")
data = job.result()
video: FileD... | Example Usage | https://gradio.app/docs/gradio/filedata | Gradio - Filedata Docs |
Parameters ▼
path: str
The server file path where the file is stored.
url: Optional[str]
The normalized server URL pointing to the file.
size: Optional[int]
The size of the file in bytes.
orig_name: Optional[str]
The original filename before upload.
... | Attributes | https://gradio.app/docs/gradio/filedata | Gradio - Filedata Docs |
Thread-safe cache with manual get/set control, injected as a function
parameter (add as a default parameter value and Gradio will inject it
automatically). Supports per-session isolation so cached data doesn't leak
between users, content-aware hashing for ML types (numpy, PIL, pandas), and
LRU eviction with memory limi... | Description | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
import gradio as gr
def generate(prompt, c=gr.Cache(per_session=True)):
hit = c.get(prompt)
if hit is not None:
return hit["result"]
result = llm(prompt)
c.set(prompt, result=result)
return result
| Example Usage | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Parameters ▼
max_size: int
default `= 128`
max_memory: str | int | None
default `= None`
per_session: bool
default `= False`
| Initialization | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Methods | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2039... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2039... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.