remove flask info logging

This commit is contained in:
Ali Abid 2020-09-22 20:35:33 -07:00
parent 63fad8b453
commit b069818f3f
4 changed files with 12 additions and 6 deletions

View File

@ -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"))

View File

@ -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

View File

@ -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"))

View File

@ -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