setting share=True on Spaces or in wasm should warn instead of raising 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>
This commit is contained in:
Abubakar Abid 2023-09-26 12:13:15 -07:00 committed by GitHub
parent f70a394912
commit e51fcd5d54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
fix:setting share=True on Spaces or in wasm should warn instead of raising error

View File

@ -2117,9 +2117,17 @@ Received outputs:
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(