mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
add show_error flag
This commit is contained in:
parent
e0e73c95b5
commit
67037adcba
@ -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()
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user