Skip to content

Commit

Permalink
setting share=True on Spaces or in wasm should warn instead of raisin…
Browse files Browse the repository at this point in the history
…g error (#5696)

* setting share=True on Spaces or in wasm should raise warning instead of error

* tweak

* add changeset

* lint

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
abidlabs and gradio-pr-bot committed Sep 26, 2023
1 parent f70a394 commit e51fcd5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-glasses-juggle.md
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:setting share=True on Spaces or in wasm should warn instead of raising error
12 changes: 10 additions & 2 deletions gradio/blocks.py
Expand Up @@ -2117,9 +2117,17 @@ def reverse(text):

if self.share:
if self.space_id:
raise RuntimeError("Share is not supported when you are in Spaces")
warnings.warn(
"Setting share=True is not supported on Hugging Face Spaces"
)
self.share = False
if wasm_utils.IS_WASM:
raise RuntimeError("Share is not supported in the Wasm environment")
warnings.warn(
"Setting share=True is not supported in the Wasm environment"
)
self.share = False

if self.share:
try:
if self.share_url is None:
self.share_url = networking.setup_tunnel(
Expand Down

0 comments on commit e51fcd5

Please sign in to comment.