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

support gradio apps on spaces served on subpaths #9814

Merged
merged 3 commits into from
Oct 23, 2024
Merged

Conversation

pngwn
Copy link
Member

@pngwn pngwn commented Oct 23, 2024

Description

It is possible to be using a subpath URL even when hosting on spaces which the client doesn't currently take into account. I have tweaked the client to support this.

This is what was breaking our demo space.

@pngwn pngwn added t: fix A change that implements a fix v: patch A change that requires a patch release labels Oct 23, 2024
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Oct 23, 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-pypi-previews.s3.amazonaws.com/abe2acb6c0383de922f73be38280737268b11408/gradio-5.3.0-py3-none-any.whl

Install Gradio Python Client from this PR

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

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/abe2acb6c0383de922f73be38280737268b11408/gradio-client-1.7.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/abe2acb6c0383de922f73be38280737268b11408/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Oct 23, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

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

With the following changelog entry.

support gradio apps on spaces served on subpaths

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.

@pngwn pngwn changed the title support spaces served on subpaths support gradio apps on spaces served on subpaths Oct 23, 2024
Comment on lines -185 to -191
if (host.endsWith("hf.space")) {
return {
ws_protocol: "wss",
host: host,
http_protocol: protocol as "http:" | "https:"
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why didnt we need this?

@@ -486,6 +486,18 @@ describe("process_endpoint", () => {
expect(response.space_id).toBe("hmb-hello-world");
expect(response.host).toBe("hmb-hello-world.hf.space");
});

it("handles huggingface subpath urls", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

noice

Copy link
Collaborator

@hannahblair hannahblair left a comment

Choose a reason for hiding this comment

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

change looks good! thanks @pngwn!

@pngwn pngwn merged commit 6505d42 into main Oct 23, 2024
23 checks passed
@pngwn pngwn deleted the fix-ssr-subpath branch October 23, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: fix A change that implements a fix v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants