From b069818f3f2902a81fb30110dc07deea28f19b2c Mon Sep 17 00:00:00 2001 From: Ali Abid Date: Tue, 22 Sep 2020 20:35:33 -0700 Subject: [PATCH] remove flask info logging --- build/lib/gradio/interface.py | 3 --- build/lib/gradio/networking.py | 6 ++++++ gradio/interface.py | 3 --- gradio/networking.py | 6 ++++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build/lib/gradio/interface.py b/build/lib/gradio/interface.py index fd95a0ca52..53bd6d0d9b 100644 --- a/build/lib/gradio/interface.py +++ b/build/lib/gradio/interface.py @@ -313,7 +313,6 @@ class Interface: is_colab = utils.colab_check() if is_colab: share = True - print("->", share) if not is_colab: if not networking.url_ok(path_to_local_server): share = True @@ -371,10 +370,8 @@ class Interface: if share: while not networking.url_ok(share_url): time.sleep(1) - print("a ->") display(IFrame(share_url, width=1000, height=500)) else: - print("b ->") display(IFrame(path_to_local_server, width=1000, height=500)) r = requests.get(path_to_local_server + "enable_sharing/" + (share_url or "None")) diff --git a/build/lib/gradio/networking.py b/build/lib/gradio/networking.py index 2cae85ef98..36bc3d3199 100644 --- a/build/lib/gradio/networking.py +++ b/build/lib/gradio/networking.py @@ -19,6 +19,7 @@ import requests import sys import csv import copy +import logging INITIAL_PORT_VALUE = int(os.getenv( 'GRADIO_SERVER_PORT', "7860")) # The http server will try to open on port 7860. If not available, 7861, 7862, etc. @@ -36,6 +37,9 @@ app = Flask(__name__, static_folder=STATIC_PATH_LIB) app.app_globals = {} +# Hide Flask default message +cli = sys.modules['flask.cli'] +cli.show_server_banner = lambda *x: None def set_meta_tags(title, description, thumbnail): app.app_globals.update({ @@ -167,6 +171,8 @@ def start_server(interface, server_port=None): ) app.interface = interface app.cwd = os.getcwd() + log = logging.getLogger('werkzeug') + log.setLevel(logging.ERROR) process = threading.Thread(target=app.run, kwargs={"port": port}) process.start() return port, app, process diff --git a/gradio/interface.py b/gradio/interface.py index fd95a0ca52..53bd6d0d9b 100644 --- a/gradio/interface.py +++ b/gradio/interface.py @@ -313,7 +313,6 @@ class Interface: is_colab = utils.colab_check() if is_colab: share = True - print("->", share) if not is_colab: if not networking.url_ok(path_to_local_server): share = True @@ -371,10 +370,8 @@ class Interface: if share: while not networking.url_ok(share_url): time.sleep(1) - print("a ->") display(IFrame(share_url, width=1000, height=500)) else: - print("b ->") display(IFrame(path_to_local_server, width=1000, height=500)) r = requests.get(path_to_local_server + "enable_sharing/" + (share_url or "None")) diff --git a/gradio/networking.py b/gradio/networking.py index 2cae85ef98..36bc3d3199 100644 --- a/gradio/networking.py +++ b/gradio/networking.py @@ -19,6 +19,7 @@ import requests import sys import csv import copy +import logging INITIAL_PORT_VALUE = int(os.getenv( 'GRADIO_SERVER_PORT', "7860")) # The http server will try to open on port 7860. If not available, 7861, 7862, etc. @@ -36,6 +37,9 @@ app = Flask(__name__, static_folder=STATIC_PATH_LIB) app.app_globals = {} +# Hide Flask default message +cli = sys.modules['flask.cli'] +cli.show_server_banner = lambda *x: None def set_meta_tags(title, description, thumbnail): app.app_globals.update({ @@ -167,6 +171,8 @@ def start_server(interface, server_port=None): ) app.interface = interface app.cwd = os.getcwd() + log = logging.getLogger('werkzeug') + log.setLevel(logging.ERROR) process = threading.Thread(target=app.run, kwargs={"port": port}) process.start() return port, app, process