add show_error flag

This commit is contained in:
dawoodkhan82 2021-10-18 14:50:28 -04:00
parent e0e73c95b5
commit 67037adcba
2 changed files with 6 additions and 2 deletions

View File

@ -478,7 +478,9 @@ class Interface:
print("PASSED")
continue
def launch(self, inline=None, inbrowser=None, share=False, debug=False, auth=None, auth_message=None, private_endpoint=None, prevent_thread_lock=False):
def launch(self, inline=None, inbrowser=None, share=False, debug=False,
auth=None, auth_message=None, private_endpoint=None,
prevent_thread_lock=False, show_error=True):
"""
Launches the webserver that serves the UI for the interface.
Parameters:
@ -492,6 +494,7 @@ class Interface:
app (flask.Flask): Flask app object
path_to_local_server (str): Locally accessible link
share_url (str): Publicly accessible link (if share=True)
show_error (bool): show prediction errors in console
"""
# Alert user if a more recent version of the library exists
utils.version_check()
@ -516,6 +519,7 @@ class Interface:
self.server_port = server_port
self.status = "RUNNING"
self.server = app
self.show_error = show_error
# Count number of launches
launch_counter()

View File

@ -179,7 +179,7 @@ def enable_sharing(path):
def predict():
raw_input = request.json["data"]
# If in debug mode, capture any errors made and pipe to front end
if app.interface.debug:
if app.interface.show_error:
try:
prediction, durations = app.interface.process(raw_input)
except BaseException as error: