Skip to content
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

Allow rendering javascript in gr.HTML #10442

Closed
wants to merge 13 commits into from
Closed

Allow rendering javascript in gr.HTML #10442

wants to merge 13 commits into from

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented Jan 27, 2025

We frequently get issues from users who want to dump HTML + JS into a gr.HTML component as a bypass (e.g. to display graphs using a custom js library) only to find that the HTML does not display as expected. That's because we strip out the JS and we tell people to instead use the js tags in Blocks to include the relevant js. But this requires manual parsing on the user's part. As discussed internally, it would make gradio more hackable if we could support this pattern

Closes: #10429

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Jan 27, 2025

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website building...
Storybook ready! Storybook preview
🦄 Changes detecting...

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/9943b383e1e820c5c25b85a2ec84d72013da85c0/gradio-5.13.1-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@9943b383e1e820c5c25b85a2ec84d72013da85c0#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/9943b383e1e820c5c25b85a2ec84d72013da85c0/gradio-client-1.10.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/9943b383e1e820c5c25b85a2ec84d72013da85c0/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Jan 27, 2025

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/html minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Allow rendering javascript in gr.HTML

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs abidlabs marked this pull request as ready for review January 27, 2025 21:07
@abidlabs abidlabs changed the title Allow js Allow rendering javascripti in gr.HTML Jan 27, 2025
@abidlabs abidlabs changed the title Allow rendering javascripti in gr.HTML Allow rendering javascript in gr.HTML Jan 27, 2025
@abidlabs abidlabs added the v: minor A change that requires a minor release label Jan 28, 2025
@abidlabs
Copy link
Member Author

Upon further reflection, a user can just iframe the value themselves, instead of us doing it. Will close this

@abidlabs abidlabs closed this Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v: minor A change that requires a minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I wanted to display ECharts through the gradio.HTML component, but I failed.
2 participants