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

Make the HTTP requests for the Wasm worker wait for the initial run_code() or run_file() to finish #5958

Merged
merged 4 commits into from
Oct 17, 2023

Conversation

whitphx
Copy link
Member

@whitphx whitphx commented Oct 17, 2023

Description

Closes: #5957

This PR includes 2 major changes.

  1. Make processing HTTP requests wait for the first run_file() or run_code() promise execution to finish. 1c99d20
  2. Top-level await will be supported with run_code(). 4a95c94

These 2 commits are related but independent, so I recommend to review them one by one.

The first one is the direct solution for the problem of #5957 .
The second one is to support top-level await syntax with run_file() or the files option. The sample code of #5957 uses run_code() or the code option so it could include the top-level await in the code. However, it has not worked with with run_file() or the files option, so this PR fixes it.

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Oct 17, 2023

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
Visual tests all good! Build review
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/98f864484c6642d3fb223b2bd5e5b7e3871bdab2/gradio-3.48.0-py3-none-any.whl

Install Gradio Python Client from this PR

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

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Oct 17, 2023

🦄 change detected

This Pull Request includes changes to the following packages.

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

With the following changelog entry.

Make the HTTP requests for the Wasm worker wait for the initial run_code() or run_file() to finish

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.

Copy link
Member Author

@whitphx whitphx Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whitphx whitphx marked this pull request as ready for review October 17, 2023 16:11
Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever. Looks good to me! Thanks @whitphx!

@abidlabs
Copy link
Member

Works beautifully! Thanks @whitphx :)

image

@abidlabs abidlabs merged commit 6780d66 into main Oct 17, 2023
17 of 18 checks passed
@abidlabs abidlabs deleted the lite-http-waits-for-first-run branch October 17, 2023 18:49
This was referenced Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lite: trying to open the connection would wait for the first run
4 participants