From 7bd425ab67894cd4f37e5a00aad67cfdfde697c8 Mon Sep 17 00:00:00 2001 From: freddyaboulton Date: Tue, 31 Jan 2023 11:05:28 -0500 Subject: [PATCH] enable share kaggle --- gradio/blocks.py | 3 ++- gradio/utils.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gradio/blocks.py b/gradio/blocks.py index de88893269156..f9813f3609192 100644 --- a/gradio/blocks.py +++ b/gradio/blocks.py @@ -1383,6 +1383,7 @@ def reverse(text): self.server = server self.is_running = True self.is_colab = utils.colab_check() + self.is_kaggle = utils.kaggle_check() self.protocol = ( "https" if self.local_url.startswith("https") or self.is_colab @@ -1405,7 +1406,7 @@ def reverse(text): share if share is not None else True - if self.is_colab and self.enable_queue + if (self.is_colab and self.enable_queue) or self.is_kaggle else False ) diff --git a/gradio/utils.py b/gradio/utils.py index 674154f4c311c..76c1a65fe0e97 100644 --- a/gradio/utils.py +++ b/gradio/utils.py @@ -189,6 +189,10 @@ def colab_check() -> bool: return is_colab +def kaggle_check() -> bool: + return bool(os.environ.get('KAGGLE_KERNEL_RUN_TYPE') or os.environ.get('GFOOTBALL_DATA_DIR')) + + def ipython_check() -> bool: """ Check if interface is launching from iPython (not colab)