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

[serve] Integrate and Document Bring-Your-Own Gradio Applications #26403

Merged
merged 11 commits into from
Aug 5, 2022

Conversation

zcin
Copy link
Contributor

@zcin zcin commented Jul 8, 2022

Why are these changes needed?

Integration between Ray Serve and Gradio. Users of Gradio can wrap their Gradio app in a Serve deployment by using GradioIngress, and scale it up through more replicas or more CPU/GPU resources.

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@zcin zcin added serve Ray Serve Related Issue docs An issue or change related to documentation labels Jul 8, 2022
@zcin zcin marked this pull request as ready for review July 14, 2022 17:22
Copy link
Contributor

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

Awesome work on the documentation!

python/ray/serve/tests/test_gradio.py Outdated Show resolved Hide resolved

class GradioIngress:
def __init__(self, io: gr.Blocks):
self.app = gr.routes.App.create_app(io)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a public API that's guaranteed by gradio to remain stable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not that I know of. Should we sync with Gradio team on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, definitely. We need to make sure any APIs we use are public & stable otherwise our integration could break at any point without warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Abubakar confirmed that this API will remain stable, and they will add tests around gr.routes.App.create_app() to make sure the API signature doesn't change!

python/ray/serve/gradio.py Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
Comment on lines 247 to 249
def fanout(self, text):
[result1, result2] = ray.get([self._d1.remote(text), self._d2.remote(text)])
return f"{result1}\n------------\n{result2}"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use async def as best practice :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately Gradio doesn't support async functions in gr.Interface yet :(

Copy link
Contributor

@shrekris-anyscale shrekris-anyscale left a comment

Choose a reason for hiding this comment

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

Great work so far on this integration! I've added some comments.

.buildkite/pipeline.yml Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
python/ray/serve/tests/test_gradio.py Outdated Show resolved Hide resolved
python/ray/serve/tests/test_gradio.py Outdated Show resolved Hide resolved
python/ray/serve/tests/test_gradio.py Outdated Show resolved Hide resolved
python/requirements.txt Show resolved Hide resolved
@zcin zcin requested a review from sihanwang41 as a code owner July 21, 2022 18:44
Copy link
Contributor

@shrekris-anyscale shrekris-anyscale left a comment

Choose a reason for hiding this comment

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

Nice updates! I added some comments for the documentation.

doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
@simon-mo simon-mo changed the title [WIP][serve] Gradio Integration [serve] Integrate and Document Bring-Your-Own Gradio Applications Jul 22, 2022
- ./ci/ci.sh build
- bazel test --config=ci $(./ci/run/bazel_export_options)
--test_tag_filters=team:serve
python/ray/serve/test_gradio
Copy link
Contributor

Choose a reason for hiding this comment

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

you should also filter out this test from regular test suites both in windows (ci.sh) and here.

@@ -16,6 +16,7 @@ batch
web-server-integration
rllib
gradio
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this page plz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I'll remove the actual file as well.

Signed-off-by: Cindy Zhang <[email protected]>
Copy link
Contributor

@shrekris-anyscale shrekris-anyscale left a comment

Choose a reason for hiding this comment

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

Nice work so far! I had a small nit about the section titling, but other that that, this change looks pretty good.

doc/source/serve/tutorials/gradio-integration.md Outdated Show resolved Hide resolved
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
@edoakes edoakes merged commit 8a9d994 into ray-project:master Aug 5, 2022
zcin added a commit to zcin/ray that referenced this pull request Aug 5, 2022
…y-project#26403)

Integration between Ray Serve and Gradio. Users of Gradio can wrap their Gradio app in a Serve deployment by using `GradioIngress`, and scale it up through more replicas or more CPU/GPU resources.

Signed-off-by: Cindy Zhang <[email protected]>
@zcin zcin deleted the gradio branch August 5, 2022 17:11
zcin added a commit that referenced this pull request Aug 5, 2022
simon-mo pushed a commit that referenced this pull request Aug 7, 2022
zcin added a commit that referenced this pull request Aug 8, 2022
…Applications (#26403)" (#27587)"

This reverts commit 64c550a.

Signed-off-by: Cindy Zhang <[email protected]>
Stefan-1313 pushed a commit to Stefan-1313/ray_mod that referenced this pull request Aug 18, 2022
…y-project#26403)

Integration between Ray Serve and Gradio. Users of Gradio can wrap their Gradio app in a Serve deployment by using `GradioIngress`, and scale it up through more replicas or more CPU/GPU resources.

Signed-off-by: Stefan van der Kleij <[email protected]>
Stefan-1313 pushed a commit to Stefan-1313/ray_mod that referenced this pull request Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs An issue or change related to documentation serve Ray Serve Related Issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants