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)