From 2bf81d0988be188caf14f8c566a2e7630b4cd376 Mon Sep 17 00:00:00 2001 From: dawoodkhan82 Date: Wed, 24 Feb 2021 14:49:55 -0500 Subject: [PATCH] colab check fix --- gradio/interface.py | 9 +++++---- gradio/networking.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gradio/interface.py b/gradio/interface.py index bf69086ed0..915d09e95f 100644 --- a/gradio/interface.py +++ b/gradio/interface.py @@ -403,10 +403,11 @@ class Interface: is_colab = utils.colab_check() if is_colab or not(networking.url_ok(path_to_local_server)): share = True - if debug: - print(strings.en["COLAB_DEBUG_TRUE"]) - else: - print(strings.en["COLAB_DEBUG_FALSE"]) + if is_colab: + if debug: + print(strings.en["COLAB_DEBUG_TRUE"]) + else: + print(strings.en["COLAB_DEBUG_FALSE"]) else: print(strings.en["RUNNING_LOCALLY"].format(path_to_local_server)) diff --git a/gradio/networking.py b/gradio/networking.py index 55918b59ba..9b9a8e43af 100644 --- a/gradio/networking.py +++ b/gradio/networking.py @@ -310,6 +310,6 @@ def setup_tunnel(local_server_port): def url_ok(url): try: r = requests.head(url) - return r.status_code == 200 or r.status_code == 401 + return r.status_code == 200 except (ConnectionError, requests.exceptions.ConnectionError): return False