mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-15 02:11:15 +08:00
Fix: Added support for show_api in mount_gradio_app (#10097)
* Fix: Added support for show_api in mount_gradio_app * add changeset * 2nd Fix: show_api in mount_gradio_app * 3rd Fix: show_api in mount_gradio_app * Update gradio/routes.py * Update gradio/routes.py --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
d5b299cfb2
commit
43d88c32bf
5
.changeset/two-ghosts-punch.md
Normal file
5
.changeset/two-ghosts-punch.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fix: Added support for show_api in mount_gradio_app
|
@ -1524,6 +1524,7 @@ def mount_gradio_app(
|
||||
path: str,
|
||||
server_name: str = "0.0.0.0",
|
||||
server_port: int = 7860,
|
||||
show_api: bool | None = None,
|
||||
app_kwargs: dict[str, Any] | None = None,
|
||||
*,
|
||||
auth: Callable | tuple[str, str] | list[tuple[str, str]] | None = None,
|
||||
@ -1557,6 +1558,7 @@ def mount_gradio_app(
|
||||
favicon_path: If a path to a file (.png, .gif, or .ico) is provided, it will be used as the favicon for this gradio app's page.
|
||||
show_error: If True, any errors in the gradio app will be displayed in an alert modal and printed in the browser console log. Otherwise, errors will only be visible in the terminal session running the Gradio app.
|
||||
max_file_size: The maximum file size in bytes that can be uploaded. Can be a string of the form "<value><unit>", where value is any positive integer and unit is one of "b", "kb", "mb", "gb", "tb". If None, no limit is set.
|
||||
show_api: If False, hides the "Use via API" button on the Gradio interface.
|
||||
ssr_mode: If True, the Gradio app will be rendered using server-side rendering mode, which is typically more performant and provides better SEO, but this requires Node 20+ to be installed on the system. If False, the app will be rendered using client-side rendering mode. If None, will use GRADIO_SSR_MODE environment variable or default to False.
|
||||
node_server_name: The name of the Node server to use for SSR. If None, will use GRADIO_NODE_SERVER_NAME environment variable or search for a node binary in the system.
|
||||
node_port: The port on which the Node server should run. If None, will use GRADIO_NODE_SERVER_PORT environment variable or find a free port.
|
||||
@ -1578,6 +1580,8 @@ def mount_gradio_app(
|
||||
)
|
||||
|
||||
blocks.dev_mode = False
|
||||
if show_api is not None:
|
||||
blocks.show_api = show_api
|
||||
blocks.max_file_size = utils._parse_file_size(max_file_size)
|
||||
blocks.config = blocks.get_config_file()
|
||||
blocks.validate_queue_settings()
|
||||
|
Loading…
Reference in New Issue
Block a user