-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 loading spaces with api_name=False #4886
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4886-all-demos |
Chromatic build successful 🎉 |
…o fix-bool-false-api
@@ -550,7 +550,7 @@ def _infer_fn_index(self, api_name: str | None, fn_index: int | None) -> int: | |||
if api_name is not None: | |||
for i, d in enumerate(self.config["dependencies"]): | |||
config_api_name = d.get("api_name") | |||
if config_api_name is None: | |||
if config_api_name is None or config_api_name is False: |
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.
Not writing as if not config_api_name
cause the api_name
can theoretically be ""
which evaluates to false.
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.
@freddyaboulton
Hmm, but I think api_name=''
should be considered invalid.
Looks like use via API page becomes weird when it has a method with api_name=''
.
In the case of the Space used for testing this PR, the API page is empty.
Also, if a Space has only one method and whose api_name
is ''
, then the API page will become like this:
Though it says there's one endpoint, but no API was shown.
I think we should change to make empty API name invalid (in another PR?).
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.
FYI, I opened a new issue for this weird behavior of API page. #4894
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.
Yea we can solve that issue in a separate PR!
Nice! Code looks good + can confirm that the original issue has been fixed. |
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.
Thanks for the quick fix. LGTM!
Description
Closes #4884
🎯 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 & Changelog
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
Unless the pull request is labeled with the "no-changelog-update" label by a maintainer of the repo, all pull requests must update the changelog located in
CHANGELOG.md
:Please add a brief summary of the change to the Upcoming Release section of the
CHANGELOG.md
file and includea link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by
[@myusername](link-to-your-github-profile)
in[PR 11111](https://github.com/gradio-app/gradio/pull/11111)
".