|
from gradio.components.base import Component |
|
|
|
from gradio.events import Dependency |
|
|
|
class Fallback(Component): |
|
def preprocess(self, payload): |
|
""" |
|
This docstring is used to generate the docs for this custom component. |
|
Parameters: |
|
payload: the data to be preprocessed, sent from the frontend |
|
Returns: |
|
the data after preprocessing, sent to the user's function in the backend |
|
""" |
|
return payload |
|
|
|
def postprocess(self, value): |
|
""" |
|
This docstring is used to generate the docs for this custom component. |
|
Parameters: |
|
payload: the data to be postprocessed, sent from the user's function in the backend |
|
Returns: |
|
the data after postprocessing, sent to the frontend |
|
""" |
|
return value |
|
|
|
def example_payload(self): |
|
return {"foo": "bar"} |
|
|
|
def example_value(self): |
|
return {"foo": "bar"} |
|
|
|
def api_info(self): |
|
return {"type": {}, "description": "any valid json"} |
|
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING |
|
from gradio.blocks import Block |
|
if TYPE_CHECKING: |
|
from gradio.components import Timer |