brk-code

gradio の API リファレンス

gradio (gradio-app/gradio) の公開 API 156 件 —— クラス 50、関数 62、メソッド 44。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。

リポジトリ: gradio-app/gradio

種別件数
クラス50
関数62
メソッド44

API 一覧

classclient.python.gradio_client.client.Client
The main Client class for the Python client.
methodclient.python.gradio_client.client.Client.view_api(all_endpoints:bool | None=None, print_info:bool=True, return_format:Literal['dict', 'str'] | None=None) -> dict | str | None
Prints the usage info for the API.
methodclient.python.gradio_client.client.Job.cancel() -> bool
Cancels the job as best as possible.
methodclient.python.gradio_client.client.Job.result(timeout:float | None=None) -> Any
Return the result of the call that the future represents.
funcclient.python.gradio_client.documentation.document_fn(fn:Callable, cls) -> tuple[str, list[dict], dict, str | None]
Generates documentation for any function.
funcclient.python.gradio_client.templates.discord_chat.on_message(message)
Continue the chat
classclient.python.gradio_client.utils.InvalidAPIEndpointError
Raised when the API endpoint is invalid.
classclient.python.gradio_client.utils.JobStatus
The job status.
classclient.python.gradio_client.utils.Status
Status codes presented to client users.
methodclient.python.gradio_client.utils.Status.ordering(status:Status) -> int
Order of messages.
classclient.python.gradio_client.utils.TooManyRequestsError
Raised when the API returns a 429 status code.
funcclient.python.gradio_client.utils.download_tmp_copy_of_file(url_path:str, token:str | None=None, dir:str | None=None) -> str
Kept for backwards compatibility for 3.x spaces.
funcclient.python.gradio_client.utils.is_valid_url(possible_url:str) -> bool
Check if the given string is a valid URL.
funcclient.python.gradio_client.utils.synchronize_async(func:Callable, *args, **kwargs) -> Any
Runs async functions in sync scopes.
funcgradio.analytics.analytics_enabled() -> bool
Returns: True if analytics are enabled, False otherwise.
methodgradio.blocks.Block.get_block_class() -> str
Gets block's class name.
methodgradio.blocks.Block.get_block_name() -> str
Gets block's class name.
methodgradio.blocks.Block.recover_kwargs(props:dict[str, Any], additional_keys:list[str] | None=None)
Recovers kwargs from a dict of props.
methodgradio.blocks.Block.render()
Adds self into appropriate BlockContext
classgradio.brotli_middleware.BrotliMiddleware
Brotli middleware public interface.
classgradio.brotli_middleware.BrotliResponder
Brotli Interface.
methodgradio.brotli_middleware.BrotliResponder.send_with_brotli(message:Message) -> None
Apply compression using brotli.
classgradio.brotli_middleware.Mode
Brotli available modes.
methodgradio.caching.Cache.clear() -> None
Clear all entries from the cache.
methodgradio.caching.Cache.get(key:Any) -> dict | None
Look up a cache entry by key.
methodgradio.caching.Cache.keys() -> list[Any]
Return all stored raw keys.
methodgradio.caching.Cache.set(key:Any, **data:Any) -> None
Store arbitrary keyword data under a key.
classgradio.caching.ProbeCache
Context manager for probe mode.
funcgradio.cli.commands.components._docs_utils.add_value(obj:dict, key:str, value:typing.Any)
Adds a value to a dictionary.
funcgradio.cli.commands.components._docs_utils.format(code:str, type:str)
Formats code using ruff.
funcgradio.cli.commands.components._docs_utils.format_none(value)
Formats None and NonType values.
funcgradio.cli.commands.components._docs_utils.format_value(value)
Formats a value.
funcgradio.cli.commands.components._docs_utils.get_param_name(param)
Gets the name of a parameter.
funcgradio.cli.commands.components._docs_utils.get_return_docstring(docstring:str)
Gets the docstring for a return value.
funcgradio.cli.commands.components._docs_utils.get_type_arguments(type_hint) -> tuple
Gets the type arguments for a type hint.
funcgradio.cli.commands.components._docs_utils.render_class_events(events:dict, name)
Renders the events for a class.
classgradio.components.api_component.Api
A generic component that holds any value.
classgradio.components.base.Component
A base class for defining methods that all input/output components should have.
methodgradio.components.base.Component.example_payload() -> Any
An example input data for this component, e.g.
methodgradio.components.base.Component.example_value() -> Any
An example output data for this component, e.g.
classgradio.components.chatbot.OptionDict
A typed dictionary to represent an option in a ChatMessage.
classgradio.components.checkbox.Checkbox
Creates a checkbox that can be set to `True` or `False`.
classgradio.components.checkboxgroup.CheckboxGroup
Creates a set of checkboxes.
methodgradio.components.code.Code.postprocess(value:str | None) -> None | str
Parameters: value: Expects a `str` of code.
classgradio.components.dataset.Dataset
Creates a gallery or table to display data samples.
classgradio.components.datetime.DateTime
Component to select a date and (optionally) a time.
methodgradio.components.datetime.DateTime.postprocess(value:float | datetime | str | None) -> str | None
Parameters: value: Expects a tuple pair of datetimes.
methodgradio.components.datetime.DateTime.preprocess(payload:str | None) -> str | float | datetime | None
Parameters: payload: the text entered in the textarea.
classgradio.components.html.HTML
Creates a component with arbitrary HTML.
methodgradio.components.html.HTML.postprocess(value:str | None) -> str | None
Parameters: value: Expects a `str` consisting of valid HTML.
classgradio.components.json_component.JSON
Used to display arbitrary JSON output prettily.
classgradio.components.markdown.Markdown
Used to render arbitrary Markdown output.
classgradio.components.navbar.Navbar
Creates a navigation bar component for multipage Gradio apps.
methodgradio.components.number.Number.preprocess(payload:float | None) -> float | int | None
Parameters: payload: the field value.
methodgradio.components.number.Number.round_to_precision(num:float | int, precision:int | None) -> float | int
Round to a given precision.
methodgradio.components.plot.Plot.preprocess(payload:PlotData | None) -> PlotData | None
Parameters: payload: The data to display in the plot.
classgradio.components.timer.Timer
Special component that ticks at regular intervals when active.
methodgradio.components.video.Video.combine_stream(stream:list[bytes], desired_output_format:str | None=None, only_file=False) -> FileData
Combine video chunks into a single video file.
funcgradio.components.video.Video.seconds_to_vtt_timestamp(seconds:float) -> str
Convert seconds to VTT timestamp format (HH:MM:SS.mmm)
methodgradio.data_classes.FileData.from_path(path:str) -> FileData
Creates a FileData object from a given file path.
methodgradio.data_classes.FileData.is_file_data(obj:Any) -> bool
Checks if an object is a valid FileData instance.
classgradio.exceptions.Error
This class allows you to pass custom error messages to the user.
classgradio.exceptions.GradioVersionIncompatibleError
Raised when loading a 3.x space with 4.0
classgradio.exceptions.InvalidComponentError
Raised when invalid components are used.
classgradio.exceptions.TooManyRequestsError
Raised when the Hugging Face API returns a 429 status code.
funcgradio.external_utils.resolve_schema_ref(schema:dict, spec:dict) -> dict
Resolve schema references in OpenAPI spec.
classgradio.flagging.ChatCSVLogger
Flagging callback for chat conversations.
methodgradio.helpers.Examples.cache(example_id:int | None=None) -> None
Caches examples so that their predictions can be shown immediately.
methodgradio.helpers.Examples.create() -> None
Creates the Dataset component to hold the examples
methodgradio.helpers.Examples.load_from_cache(example_id:int) -> list[Any]
Loads a particular cached example for the interface.
methodgradio.helpers.Progress.close(_tqdm)
Removes iterable with given _tqdm.
funcgradio.helpers.update(elem_id:str | None=None, elem_classes:list[str] | str | None=None, visible:bool | Literal['hidden'] | None=None, **kwargs:Any) -> dict[str, Any]
Updates a component's properties.
classgradio.i18n.I18n
Handles internationalization (i18n) for Gradio applications.
classgradio.i18n.I18nData
A class that wraps a translation key with metadata.
methodgradio.i18n.I18nData.to_dict() -> dict[str, Any]
Convert the I18nData object to a dictionary for serialization.
funcgradio.image_utils.add_watermark(base_img:np.ndarray | PIL.Image.Image | str | Path, watermark_option:WatermarkOptions) -> PIL.Image.Image
Overlays a watermark image on a base image.
funcgradio.image_utils.open_image(orig_img:np.ndarray | PIL.Image.Image | str | Path) -> PIL.Image.Image
Provided an array, PIL Image or filepath, return a PIL Image.
classgradio.ipython_ext.CellIdTracker
Determines the most recently run cell in the notebook.
classgradio.layouts.tabs.Tab
Tab (or its alias TabItem) is a layout element.
classgradio.layouts.walkthrough.Step
Step is a layout element.
classgradio.mcp.GradioMCPServer
A class for creating an MCP server around a Gradio app.
funcgradio.mcp.GradioMCPServer.call_tool(name:str, arguments:dict[str, Any]) -> self.types.CallToolResult
Call a tool on the Gradio app.
methodgradio.mcp.GradioMCPServer.create_mcp_server() -> 'Server'
Create an MCP server for the given Gradio Blocks app.
methodgradio.mcp.GradioMCPServer.get_base64_data(image:Image.Image, format:str) -> str
Returns a base64 encoded string of the image.
methodgradio.mcp.GradioMCPServer.get_block_fn_from_endpoint_name(endpoint_name:str) -> 'BlockFunction | None'
Get the BlockFunction for a given endpoint name (e.g.
methodgradio.mcp.GradioMCPServer.get_complete_schema(request) -> JSONResponse
Get the complete schema of the Gradio app API.
methodgradio.mcp.GradioMCPServer.get_image(file_path:str) -> Image.Image | None
If a filepath is a valid image, returns a PIL Image object.
funcgradio.mcp.GradioMCPServer.get_prompt(name:str, arguments:dict[str, Any] | None=None) -> self.types.GetPromptResult
Get a specific prompt with filled-in arguments.
methodgradio.mcp.GradioMCPServer.get_route_path(request:Request) -> str
Gets the route path of the MCP server based on the incoming request.
methodgradio.mcp.GradioMCPServer.launch_mcp_on_sse(app:Starlette, subpath:str, root_path:str) -> None
Launch the MCP server on the SSE transport.
funcgradio.mcp.GradioMCPServer.lifespan(app:Starlette) -> AsyncIterator[None]
Context manager for managing session manager lifecycle.
funcgradio.mcp.GradioMCPServer.list_prompts() -> list[self.types.Prompt]
List all available prompts.
funcgradio.mcp.GradioMCPServer.list_resource_templates() -> list[self.types.ResourceTemplate]
List all available resource templates.
funcgradio.mcp.GradioMCPServer.list_resources() -> list[self.types.Resource]
List all available resources.
funcgradio.mcp.GradioMCPServer.list_tools() -> list[self.types.Tool]
List all tools on the Gradio app.
funcgradio.mcp.GradioMCPServer.read_resource(uri:AnyUrl | str) -> list[self.ReadResourceContents]
Read a specific resource by URI.
methodgradio.mcp.GradioMCPServer.warn_about_state_inputs() -> None
Warn about tools that have gr.State inputs.
funcgradio.mcp.prompt(name:str | None=None, description:str | None=None)
Decorator to mark a function as an MCP prompt.
funcgradio.media.get_audio(filename:Optional[str]=None) -> str
Get path to an audio file.
funcgradio.media.get_file(filename:Optional[str]=None) -> str
Get path to a data file (CSV, JSON, text, etc.).
funcgradio.media.get_image(filename:Optional[str]=None) -> str
Get path to an image file.
funcgradio.media.get_model3d(filename:Optional[str]=None) -> str
Get path to a 3D model file.
funcgradio.media.get_video(filename:Optional[str]=None) -> str
Get path to a video file.
funcgradio.node_server.attempt_connection(host:str, port:int) -> bool
Attempts a single connection to the server.
funcgradio.node_server.drain_stderr(stream, buffer:deque[str]) -> None
Reads the Node server's stderr, keeping only the most recent lines.
funcgradio.oauth.oauth_login(request:fastapi.Request)
Endpoint that redirects to HF OAuth page.
funcgradio.oauth.oauth_logout(request:fastapi.Request) -> RedirectResponse
Endpoint that logs out the user (e.g.
funcgradio.oauth.oauth_redirect_callback(request:fastapi.Request) -> RedirectResponse
Endpoint that handles the OAuth callback.
funcgradio.processing_utils.convert_video_to_playable_mp4(video_path:str) -> str
Convert the video to mp4.
funcgradio.processing_utils.detect_audio_format(data:bytes) -> str
Detect audio format from file header bytes.
funcgradio.processing_utils.extract_base64_data(x:str) -> str
Just extracts the base64 data from a general base64 string.
funcgradio.processing_utils.video_is_playable(video_filepath:str) -> bool
Determines if a video is playable in the browser.
classgradio.route_utils.GradioMultiPartParser
Vendored from starlette.MultipartParser.
classgradio.route_utils.GradioUploadFile
UploadFile with a sha attribute.
classgradio.route_utils.Obj
Using a class to convert dictionaries into objects.
funcgradio.route_utils.create_url_safe_hash(data:bytes, digest_size=8)
Create a URL-safe short hash of the data.
funcgradio.route_utils.delete_files_created_by_app(blocks:Blocks, age:int | None) -> None
Delete files that are older than age.
funcgradio.route_utils.get_api_call_path(request:fastapi.Request) -> str
Extracts the API call path from the request URL.
funcgradio.route_utils.get_root_url(request:fastapi.Request, route_path:str, root_path:str | None) -> str
Gets the root url of the Gradio app (i.e.
funcgradio.route_utils.slugify(value)
Convert to ASCII.
classgradio.routes.App
FastAPI App Wrapper
funcgradio.routes.App.split_reasoning_code(text:str) -> tuple[str, str]
Extract all <reasoning>...</reasoning> and code.
funcgradio.routes.App.strip_think_blocks(text:str) -> str
Remove any <think> ...
classgradio.static_server.StaticWorkerPool
Manages N static file server processes.
methodgradio.static_server.StaticWorkerPool.get_next_url() -> str
Round-robin to the next static worker.
methodgradio.static_server.StaticWorkerPool.shutdown()
Stop all static worker processes.
methodgradio.static_server.StaticWorkerPool.start()
Spawn all static worker processes.
classgradio.templates.Files
Sets: file_count="multiple"
classgradio.templates.ImageMask
Sets: brush=Brush(colors=["#000000"], color_mode="fixed")
classgradio.templates.List
Sets: type="array", col_count=1
classgradio.templates.Matrix
Sets: type="array"
classgradio.templates.Microphone
Sets: sources=["microphone"]
classgradio.templates.Numpy
Sets: type="numpy"
classgradio.templates.Paint
Sets: sources=()
classgradio.templates.PlayableVideo
Sets: format="mp4"
classgradio.templates.TextArea
Sets: lines=7
classgradio.utils.SyncToAsyncIterator
Treat a synchronous iterator as async one.
funcgradio.utils.async_lambda(f:Callable) -> Callable
Turn a function into an async function.
funcgradio.utils.connect_heartbeat(config:BlocksConfigDict, blocks, fns=None) -> bool
Determines whether a heartbeat is required for a given config.
funcgradio.utils.deep_equal(a:Any, b:Any) -> bool
Deep equality check for component values.
funcgradio.utils.delete_none(_dict:dict, skip_value:bool=False, skip_props:list[str] | None=None) -> dict
Delete keys whose values are None from a dictionary
funcgradio.utils.find_user_stack_level() -> int
Find the first stack frame not inside Gradio.
funcgradio.utils.is_in_or_equal(path_1:str | Path, path_2:str | Path) -> bool
True if path_1 is a descendant (i.e.
funcgradio.utils.run_coro_in_background(func:Callable, *args, **kwargs)
Runs coroutines in background.
funcgradio.utils.safe_get_lock() -> asyncio.Lock
Get asyncio.Lock() without fear of getting an Exception.
funcgradio.utils.set_static_paths(paths:str | Path | list[str | Path]) -> None
Set the static paths to be served by the gradio app.
funcgradio.utils.watchfn(reloader:SourceFileReloader) -> None
Watch python files in a given module.
classgradio.workflow.Workflow
Build and launch a visual AI workflow as a Gradio app.
methodgradio.workflow.Workflow.launch(*args, **kwargs)
Launch the workflow as a Gradio app.
funcgradio.workflow.get_oauth_available(_data=None) -> str
Whether OAuth sign-in is actually wired up.
funcgradio.workflow.get_token(_data=None, request:Optional[Request]=None, token:Optional[OAuthToken]=None) -> str
Return the HF token for this browser session.
classgradio.workflow_api.WorkflowExecutor
Runs a subject's upstream sub-DAG server-side.
methodgradio.workflow_api.WorkflowExecutor.run(subject_id:str, inputs:dict[str, Any], request:Any=None, token:Any=None) -> Any
Execute the subgraph feeding `subject_id`.
classgradio.workflow_api.WorkflowGraph
Parsed, indexed view of a schema-v2 workflow dict.
funcgradio.workflow_api.upstream_node_ids(graph:WorkflowGraph, target_id:str) -> set[str]
All nodes transitively feeding `target_id` (inclusive).
methodjs._website.generate_jsons.chunking.TextChunker.count_tokens(text:str) -> int
Count the number of tokens in a text string.

この情報について

掲載しているシグネチャは gradio-app/gradio の公開ソースコードを Python の ast モジュールで静的解析し、引数名・デフォルト値・ 型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。 詳しくは仕組みの解説をご覧ください。

収録ライブラリ一覧(全 805 件)へ戻る