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

Fix api recorder #8247

Merged
merged 45 commits into from May 17, 2024
Merged

Fix api recorder #8247

merged 45 commits into from May 17, 2024

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented May 9, 2024

Fixes issue where API Recorder would stop working (the fix was to explicitly handle the case where one of the inputs was gr.State). Fixed for both the Python and JS code snippets.

Closes: #8259 (test either of the demos locally)
Closes: #7982 (test on this Space with this PR installed)

Also fixes the RecordingSnippet for JS Client to ensure that it uses the new kwarg syntax instead of the positional syntax and adds an e2e -- the playwright api recorder helped me write the test hehe

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented May 9, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website failed! Details
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/abb52a0f0105025a520584dd633508bf0eda6b40/gradio-4.31.3-py3-none-any.whl

Install Gradio Python Client from this PR

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

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented May 9, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/app patch
gradio patch
gradio_client patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Fix api recorder

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 added the v: patch A change that requires a patch release label May 16, 2024
@abidlabs abidlabs marked this pull request as ready for review May 16, 2024 23:42
@abidlabs abidlabs requested a review from hannahblair May 16, 2024 23:47
@@ -415,8 +416,11 @@ def main(request: fastapi.Request, user: str = Depends(get_current_user)):

@app.get("/info/", dependencies=[Depends(login_check)])
@app.get("/info", dependencies=[Depends(login_check)])
def api_info():
# The api info is set in create_app
def api_info(all_endpoints: bool = False):
Copy link
Member Author

Choose a reason for hiding this comment

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

Initially, I had implemented it so that the /info route just returned all of the endpoints, even those with show_api=False and we filtered in the frontend. However, this led to very, very large payloads for complex apps like the theme builder causing slow load times / crashing. We should figure out a way to reduce the payload for /info, but in the meantime, here we don't load all endpoints by default -- only if you use the API Recorder.

Copy link
Collaborator

@aliabd aliabd left a comment

Choose a reason for hiding this comment

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

nice, LGTM! I tested everything and it all works as expected now.

Ignore the website build issue will fix it on a separate PR as it isn't related to this.

@abidlabs
Copy link
Member Author

Sweet thanks @aliabd!

@abidlabs abidlabs merged commit 8f46556 into main May 17, 2024
10 checks passed
@abidlabs abidlabs deleted the fix-api-recorder branch May 17, 2024 20:37
@pngwn pngwn mentioned this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API recorder broken on several demos API Recording breaking on Space
3 participants