-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Gradio-lite #4390
Closed
Closed
[WIP] Gradio-lite #4390
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84dba91
to
1b31753
Compare
…main and the worker threads, and bundle the worker with Vite
…tatements with Wasm checks
…e an API to set the Python code
…to communicate with the Wasm worker
…hey are not included in the normal build
0e96113
to
e7855cd
Compare
… files dynamically at build time
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A Wasm-port of Gradio using Pyodide.
/wasm
directory contains the Wasm-related code. The architecture is like Shinylive or stlite where Pyodide runs on a WebWorker (src/webworker/index.ts
) and the frontend app communicates with the server running on the worker through a "worker proxy" object (src/worker-proxy.ts
).@gradio/app
) in thejs/app/
directory uses the worker proxy.The frontend app is using a client library (
@gradio/client
in theclient/js
directory), so I addedoverridden_fetch
option to the client library to inject thefetch()
and used it to make the client object to dispatch requests to the worker proxy.fetch()
function. So let us discuss about how we should modify the design around the client to switch between the normal HTTP comms (fetch
) and the emulated HTTP for Wasm.@gradio/app
and it will be compiled into the/lite
directory withpnpm build:lite
command.TODO:
@gradio/app
(making dead code elimination to work onwebworker.js
).Future Works
File
andUploadButton
work on Wasm, which usesupload_files
.Closes: # (issue)
Checklist:
A note about the CHANGELOG
Hello 👋 and thank you for contributing to Gradio!
All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.
Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by
[@myusername](link-to-your-github-profile)
in[PR 11111](https://github.com/gradio-app/gradio/pull/11111)
".If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.