-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix path generation for returned files for bash API #10841
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
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/70fc8e55892c548ac3dce4f67ff2be06f9d83b49/gradio-5.22.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@70fc8e55892c548ac3dce4f67ff2be06f9d83b49#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/70fc8e55892c548ac3dce4f67ff2be06f9d83b49/gradio-client-1.13.1.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/70fc8e55892c548ac3dce4f67ff2be06f9d83b49/dist/lite.js""></script> |
🦄 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.
|
I am trying to fix the issues with the tests, but I don't understand why this test should be considered correct. # input
(
"https://www.gradio.app/playground/",
f"{API_PREFIX}/",
"http://www.gradio.app/",
"http://www.gradio.app"
)
# test call
def test_get_root_url(
request_url: str, route_path: str, root_path: str, expected_root_url: str
): What is the expected behavior here? That
I think this is a case where the method should fail rather than pass. But would this impact Gradio's functionality? For example, this input wouldn't work: (
"https://www.gradio.app/playground/",
f"{API_PREFIX}/call/predict",
"/playground",
"https://www.gradio.app/playground",
)
# results in: 'https://w/playground' @abidlabs What is the expected behaviour for the |
Also in the # inputs
root_path = ''
root_url = 'http://127.0.0.1:7860/gradio_api/run/predict'
route_path = '/gradio_api/api/predict'
# The two strings have the same lenght, that's why it worked till now...
/gradio_api/run/predict
/gradio_api/api/predict |
I have now removed the exception from the |
Taking a look at this now @cansik |
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.
No the reason this test passes is because if a developer specifies a full URL as the |
@cansik I'm having issues with this change. The |
Description
As explained in #9049 (comment), the
root_path
calculation was limited to/gradio_api/queue/join
requests, which led to incorrect string manipulation for calls to/gradio_api/call/predict
(used by the Bash API).In this PR, a new method is implemented to check whether the request was made to
/gradio_api/queue/join
or/gradio_api/call
and then correctly calculates theroot_path
to subtract from the URL. This ensures that calls to any/gradio_api/call/*
route are handled correctly (e.g., when using Gradio blocks).Closes: #9049
Closes: #9317
Closes: #10839