mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
bump to node 20 (#9632)
* bump to node 20 * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
2eaa0667e1
commit
9b58ab00b7
5
.changeset/clear-walls-unite.md
Normal file
5
.changeset/clear-walls-unite.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": minor
|
||||
---
|
||||
|
||||
feat:bump to node 20
|
@ -391,7 +391,9 @@ class Block:
|
||||
return client_utils.synchronize_async(
|
||||
processing_utils.async_move_files_to_cache, data, self
|
||||
)
|
||||
except AttributeError: # Can be raised if this function is called before the Block is fully initialized.
|
||||
except (
|
||||
AttributeError
|
||||
): # Can be raised if this function is called before the Block is fully initialized.
|
||||
return data
|
||||
|
||||
|
||||
@ -2316,7 +2318,7 @@ Received inputs:
|
||||
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.
|
||||
enable_monitoring: Enables traffic monitoring of the app through the /monitoring endpoint. By default is None, which enables this endpoint. If explicitly True, will also print the monitoring URL to the console. If False, will disable monitoring altogether.
|
||||
strict_cors: If True, prevents external domains from making requests to a Gradio server running on localhost. If False, allows requests to localhost that originate from localhost but also, crucially, from "null". This parameter should normally be True to prevent CSRF attacks but may need to be False when embedding a *locally-running Gradio app* using web components.
|
||||
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 18+ 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.
|
||||
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.
|
||||
Returns:
|
||||
app: FastAPI app object that is running the demo
|
||||
local_url: Locally accessible link to the demo
|
||||
|
@ -139,7 +139,7 @@ def start_node_process(
|
||||
f"Cannot start Node server on any port in the range {server_ports[0]}-{server_ports[-1]}."
|
||||
)
|
||||
print(
|
||||
"Please install Node 18 or higher and set the environment variable GRADIO_NODE_PATH to the path of your Node executable."
|
||||
"Please install Node 20 or higher and set the environment variable GRADIO_NODE_PATH to the path of your Node executable."
|
||||
)
|
||||
print(
|
||||
"You can explicitly specify a port by setting the environment variable GRADIO_NODE_PORT."
|
||||
|
@ -461,7 +461,9 @@ class App(FastAPI):
|
||||
not callable(app.auth)
|
||||
and username in app.auth
|
||||
and compare_passwords_securely(password, app.auth[username]) # type: ignore
|
||||
) or (callable(app.auth) and app.auth.__call__(username, password)): # type: ignore
|
||||
) or (
|
||||
callable(app.auth) and app.auth.__call__(username, password)
|
||||
): # type: ignore
|
||||
token = secrets.token_urlsafe(16)
|
||||
app.tokens[token] = username
|
||||
response = JSONResponse(content={"success": True})
|
||||
@ -1553,7 +1555,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.
|
||||
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 18+ 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.
|
||||
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.
|
||||
Example:
|
||||
|
@ -1550,7 +1550,7 @@ def get_node_path():
|
||||
|
||||
print("Unable to find node install path, falling back to SPA mode.")
|
||||
print(
|
||||
"If you wish to use the node backend, please install node 18 and/ or set the path with the GRADIO_NODE_PATH environment variable."
|
||||
"If you wish to use the node backend, please install node 20 and/ or set the path with the GRADIO_NODE_PATH environment variable."
|
||||
)
|
||||
return None
|
||||
|
||||
|
@ -10,7 +10,7 @@ You will need to have:
|
||||
|
||||
* Python 3.10+ (<a href="https://www.python.org/downloads/" target="_blank">install here</a>)
|
||||
* pip 21.3+ (`python -m pip install --upgrade pip`)
|
||||
* Node.js v16.14+ (<a href="https://nodejs.dev/en/download/package-manager/" target="_blank">install here</a>)
|
||||
* Node.js 20+ (<a href="https://nodejs.dev/en/download/package-manager/" target="_blank">install here</a>)
|
||||
* npm 9+ (<a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm/" target="_blank">install here</a>)
|
||||
* Gradio 5+ (`pip install --upgrade gradio`)
|
||||
|
||||
|
@ -7,7 +7,7 @@ This is a sneak preview of what our finished component will look like:
|
||||
![demo](https://gradio-builds.s3.amazonaws.com/assets/PDFDisplay.png)
|
||||
|
||||
## Step 0: Prerequisites
|
||||
Make sure you have gradio 4.0 or higher installed as well as node 18+.
|
||||
Make sure you have gradio 5.0 or higher installed as well as node 20+.
|
||||
As of the time of publication, the latest release is 4.1.1.
|
||||
Also, please read the [Five Minute Tour](./custom-components-in-five-minutes) of custom components and the [Key Concepts](./key-component-concepts) guide before starting.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user