-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Cache view_api info in server and python client #7888
Cache view_api info in server and python client #7888
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/ee0da9a1d4b94c42b84c798da0fb1b765172d673/gradio-4.24.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@ee0da9a1d4b94c42b84c798da0fb1b765172d673#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
@@ -1029,8 +1028,6 @@ def _get_component_type(self, component_id: int): | |||
) | |||
|
|||
def _get_parameters_info(self) -> list[ParameterInfo] | None: | |||
if not self.client._info: | |||
self._info = self.client._get_api_info() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops 😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for fixing this @freddyaboulton!
Thank you for the quick review!! And @pseudotensor for the tip about the test |
Description
Closes: #7882
The client will call the api info endpoint only once during initialization. The server caches the result because right now it should not change throughout the lifetime of the app. This is for the case where many clients connect to view the api info simultaneously.
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh