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

Add session hash to gr request #8117

Merged
merged 4 commits into from Apr 24, 2024
Merged

Conversation

freddyaboulton
Copy link
Collaborator

@freddyaboulton freddyaboulton commented Apr 24, 2024

Description

Being able to pull the session_hash has come up twice recently: the command+R demo and I personally wanted build a demo where I use the session hash to save some files to disk and then clean them up with unload. To get the session hash, you have to use await request.body() which is not ideal since you'd have to make your handler async and it's also not clear you have to parse the body to get the session hash.

I think this should make it easier in the future for others.

🎯 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

  1. 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

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Apr 24, 2024

🪼 branch checks and previews

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

Install Gradio from this PR

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

Install Gradio Python Client from this PR

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

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Apr 24, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Add session hash to gr request

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

@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.

Ah this is awesome, thanks @freddyaboulton! I can think of loads of cases where this will be useful. This makes things much easier.

@freddyaboulton freddyaboulton added the v: patch A change that requires a patch release label Apr 24, 2024
@freddyaboulton
Copy link
Collaborator Author

Thanks @pngwn !

@freddyaboulton freddyaboulton merged commit 6864035 into main Apr 24, 2024
7 checks passed
@freddyaboulton freddyaboulton deleted the add-session-hash-to-gr-request branch April 24, 2024 19:29
@abidlabs
Copy link
Member

Nice!

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.

None yet

4 participants