mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-27 02:30:17 +08:00
working on piping
This commit is contained in:
parent
e559f8f9e7
commit
e6d5c8663e
@ -204,7 +204,7 @@ class Interface:
|
||||
return
|
||||
raise RuntimeError("Validation did not pass")
|
||||
|
||||
def launch(self, inline=None, inbrowser=None, share=False, validate=True):
|
||||
def launch(self, inline=None, inbrowser=None, share=False, validate=True, debug=False):
|
||||
"""
|
||||
Standard method shared by interfaces that creates the interface and sets up a websocket to communicate with it.
|
||||
:param inline: boolean. If True, then a gradio interface is created inline (e.g. in jupyter or colab notebook)
|
||||
@ -247,6 +247,7 @@ class Interface:
|
||||
from_ipynb = get_ipython()
|
||||
if "google.colab" in str(from_ipynb):
|
||||
is_colab = True
|
||||
print("Google colab notebook detected.")
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
@ -262,8 +263,14 @@ class Interface:
|
||||
except: # TODO(abidlabs): don't catch all exceptions
|
||||
pass
|
||||
|
||||
# if not is_colab:
|
||||
print(strings.en["RUNNING_LOCALLY"].format(path_to_local_server))
|
||||
if not is_colab:
|
||||
print(strings.en["RUNNING_LOCALLY"].format(path_to_local_server))
|
||||
else:
|
||||
if debug:
|
||||
print("This cell will run indefinitely so that you can see errors and logs. To turn off, "
|
||||
"set debug=False in launch().")
|
||||
else:
|
||||
print("To show errors in colab notebook, set debug=True in launch()")
|
||||
|
||||
if share:
|
||||
try:
|
||||
@ -330,4 +337,9 @@ class Interface:
|
||||
|
||||
networking.set_config(config, output_directory)
|
||||
|
||||
if debug:
|
||||
while True:
|
||||
sys.stdout.flush()
|
||||
time.sleep(0.1)
|
||||
|
||||
return httpd, path_to_local_server, share_url
|
||||
|
@ -1,6 +1,6 @@
|
||||
en = {
|
||||
"BETA_MESSAGE": "NOTE: Gradio is in beta stage, please report all bugs to: gradio.app@gmail.com",
|
||||
"RUNNING_LOCALLY": "Running at: {}",
|
||||
"RUNNING_LOCALLY": "Running locally at: {}",
|
||||
"NGROK_NO_INTERNET": "Unable to create public link for interface, please check internet connection or try "
|
||||
"restarting python interpreter.",
|
||||
"COLAB_NO_LOCAL": "Cannot display local interface on google colab, public link created.",
|
||||
|
Loading…
Reference in New Issue
Block a user