Introducing Gradio 5.0
Read MoreIntroducing Gradio 5.0
Read MoreNew to Gradio? Start here: Getting Started
See the Release History
To install the Gradio Python Client from main, run the following command:
pip install 'gradio-client @ git+https://github.com/gradio-app/gradio@4aa0e887a6e4b0245c01aac5a57f2adce67ade9a#subdirectory=client/python'
gradio_client.Job(···)
future: Future
The future object that represents the prediction call, created by the Client.submit() method
communicator: Communicator | None
= None
The communicator object that is used to communicate between the client and the background thread running the job
verbose: bool
= True
Whether to print any status-related messages to the console
space_id: str | None
= None
The space ID corresponding to the Client object that created this Job object
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.
The Job component supports the following event listeners. Each event listener takes the same parameters, which are listed in the Event Parameters table below.
Listener | Description |
---|---|
| Return the result of the call that the future represents. Raises CancelledError: If the future was cancelled, TimeoutError: If the future didn't finish executing before the given timeout, and Exception: If the call raised then that exception will be raised. <br> |
| Returns a list containing the latest outputs from the Job. <br> If the endpoint has multiple output components, the list will contain a tuple of results. Otherwise, it will contain the results without storing them in tuples. <br> For endpoints that are queued, this list will contain the final job output even if that endpoint does not use a generator function. <br> |
| Returns the latest status update from the Job in the form of a StatusUpdate object, which contains the following fields: code, rank, queue_size, success, time, eta, and progress_data. <br> progress_data is a list of updates emitted by the gr.Progress() tracker of the event handler. Each element of the list has the following fields: index, length, unit, progress, desc. If the event handler does not have a gr.Progress() tracker, the progress_data field will be None. <br> |
timeout: float | None
= None
The number of seconds to wait for the result if the future isn't done. If None, then there is no limit on the wait time.