mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-27 02:30:17 +08:00
correctly handle no internet connection with share=True
This commit is contained in:
parent
c079055049
commit
02eaf4cfcc
@ -719,7 +719,6 @@ class Interface:
|
|||||||
|
|
||||||
if private_endpoint is not None:
|
if private_endpoint is not None:
|
||||||
share = True
|
share = True
|
||||||
self.share = share
|
|
||||||
|
|
||||||
if share:
|
if share:
|
||||||
try:
|
try:
|
||||||
@ -734,10 +733,14 @@ class Interface:
|
|||||||
if self.analytics_enabled:
|
if self.analytics_enabled:
|
||||||
utils.error_analytics(self.ip_address, "Not able to set up tunnel")
|
utils.error_analytics(self.ip_address, "Not able to set up tunnel")
|
||||||
share_url = None
|
share_url = None
|
||||||
|
share = False
|
||||||
|
print(strings.en["COULD_NOT_GET_SHARE_LINK"])
|
||||||
else:
|
else:
|
||||||
print(strings.en["PUBLIC_SHARE_TRUE"])
|
print(strings.en["PUBLIC_SHARE_TRUE"])
|
||||||
share_url = None
|
share_url = None
|
||||||
|
|
||||||
|
self.share = share
|
||||||
|
|
||||||
if inbrowser:
|
if inbrowser:
|
||||||
link = share_url if share else path_to_local_server
|
link = share_url if share else path_to_local_server
|
||||||
webbrowser.open(link)
|
webbrowser.open(link)
|
||||||
|
@ -7,6 +7,7 @@ MESSAGING_API_ENDPOINT = "https://api.gradio.app/gradio-messaging/en"
|
|||||||
en = {
|
en = {
|
||||||
"RUNNING_LOCALLY": "Running on local URL: {}",
|
"RUNNING_LOCALLY": "Running on local URL: {}",
|
||||||
"SHARE_LINK_DISPLAY": "Running on public URL: {}",
|
"SHARE_LINK_DISPLAY": "Running on public URL: {}",
|
||||||
|
"COULD_NOT_GET_SHARE_LINK": "\nCould not create share link, please check your internet connection.",
|
||||||
"COLAB_NO_LOCAL": "Cannot display local interface on google colab, public link created.",
|
"COLAB_NO_LOCAL": "Cannot display local interface on google colab, public link created.",
|
||||||
"PUBLIC_SHARE_TRUE": "\nTo create a public link, set `share=True` in `launch()`.",
|
"PUBLIC_SHARE_TRUE": "\nTo create a public link, set `share=True` in `launch()`.",
|
||||||
"MODEL_PUBLICLY_AVAILABLE_URL": "Model available publicly at: {} (may take up to a minute for link to be usable)",
|
"MODEL_PUBLICLY_AVAILABLE_URL": "Model available publicly at: {} (may take up to a minute for link to be usable)",
|
||||||
@ -18,7 +19,7 @@ en = {
|
|||||||
"COLAB_DEBUG_TRUE": "Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. "
|
"COLAB_DEBUG_TRUE": "Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. "
|
||||||
"To turn off, set debug=False in launch().",
|
"To turn off, set debug=False in launch().",
|
||||||
"COLAB_DEBUG_FALSE": "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()",
|
"COLAB_DEBUG_FALSE": "Colab notebook detected. To show errors in colab notebook, set debug=True in launch()",
|
||||||
"SHARE_LINK_MESSAGE": "\nThis share link expires in 72 hours. For free permanent hosting, check out Spaces (https://huggingface.co/spaces)",
|
"SHARE_LINK_MESSAGE": "\nThis share link expires in 72 hours. For free permanent hosting, check out Spaces (https://www.huggingface.co/spaces)",
|
||||||
"PRIVATE_LINK_MESSAGE": "Since this is a private endpoint, this share link will never expire.",
|
"PRIVATE_LINK_MESSAGE": "Since this is a private endpoint, this share link will never expire.",
|
||||||
"INLINE_DISPLAY_BELOW": "Interface loading below...",
|
"INLINE_DISPLAY_BELOW": "Interface loading below...",
|
||||||
"MEDIA_PERMISSIONS_IN_COLAB": "Your interface requires microphone or webcam permissions - this may cause issues in Colab. Use the External URL in case of issues.",
|
"MEDIA_PERMISSIONS_IN_COLAB": "Your interface requires microphone or webcam permissions - this may cause issues in Colab. Use the External URL in case of issues.",
|
||||||
|
Loading…
Reference in New Issue
Block a user