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 Python Client to upload/download files when connecting to Gradio apps with auth enabled #7555
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/1c2390a13fea025afeb7a6acd7f66025a442a272/gradio-4.19.2-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@1c2390a13fea025afeb7a6acd7f66025a442a272#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.
|
If auth is set to gradio, calling from gradio_client to api will fail with exception: server rejected WebSocket connection: HTTP 403 Current gradio version in GPT-SoVITS is 3.38.0 and official fix is on 4.9.0 according to: gradio-app/gradio#6605 This commit upgrades gradio to latest version of 4.19.2 and modified deprecated arguments in code, and will fix server-side problem. On the other hand, the client-side of gradio_client of the latest version of 0.10.1 raises a new exception when uploading a file to a api protected by auth: ValueError: None The fix for the problem has no effect to the server-side due to ongoing pull request: gradio-app/gradio#7555 so this commit may be useful.
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! nice work
@@ -731,7 +731,7 @@ def _login(self, auth: tuple[str, str]): | |||
data={"username": auth[0], "password": auth[1]}, | |||
) | |||
if not resp.is_success: | |||
raise ValueError(f"Could not login to {self.src}") | |||
raise AuthenticationError(f"Could not login to {self.src}") |
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.
just fyi this will raise even when the problem isn't authentication, but the link being down for example because the space is sleeping. don't think it matters but if you want to make it strictly for authentication like you described in exceptions.py you should look at the status code.
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.
Nice catch, will fix
Thanks @aliabd! Appreciate the review -- made the fix and will merge it in after CI |
which release has this fix ? |
gradio_client@0.11.0 found it |
Continuing the streak of
auth
-related fixes. This PR fixes: #6717I've added a test, but you can also test that it works with Spaces:
Also just did some minor cleanup of the relevant code