mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-12 12:40:29 +08:00
Better message when share link is not created (#4773)
* better message when share link is not created * remove comment * changelog * changes * delete share
This commit is contained in:
parent
acec00f60b
commit
f76348de02
@ -44,8 +44,8 @@
|
||||
- Update depedencies by [@pngwn](https://github.com/pngwn) in [PR 4643](https://github.com/gradio-app/gradio/pull/4643)
|
||||
- The theme builder now launches successfully, and the API docs are cleaned up. By [@abidlabs](https://github.com/aliabid94) in [PR 4683](https://github.com/gradio-app/gradio/pull/4683)
|
||||
- Remove `cleared_value` from some components as its no longer used internally by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4685](https://github.com/gradio-app/gradio/pull/4685)
|
||||
- Better errors when you define two Blocks and reference components in one Blocks from the events in the other Blocks [@abidlabs](https://github.com/aliabid94) in [PR 4738](https://github.com/gradio-app/gradio/pull/4738).
|
||||
|
||||
- Better errors when you define two Blocks and reference components in one Blocks from the events in the other Blocks [@abidlabs](https://github.com/abidlabs) in [PR 4738](https://github.com/gradio-app/gradio/pull/4738).
|
||||
- Better message when share link is not created by [@abidlabs](https://github.com/abidlabs) in [PR 4773](https://github.com/gradio-app/gradio/pull/4773).
|
||||
|
||||
## Breaking Changes:
|
||||
|
||||
|
@ -11,6 +11,7 @@ import time
|
||||
import warnings
|
||||
import webbrowser
|
||||
from abc import abstractmethod
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
from typing import TYPE_CHECKING, Any, AsyncIterator, Callable, Literal, cast
|
||||
|
||||
@ -44,7 +45,13 @@ from gradio.exceptions import (
|
||||
from gradio.helpers import EventData, create_tracker, skip, special_args
|
||||
from gradio.themes import Default as DefaultTheme
|
||||
from gradio.themes import ThemeClass as Theme
|
||||
from gradio.tunneling import BINARY_PATH, CURRENT_TUNNELS
|
||||
from gradio.tunneling import (
|
||||
BINARY_FILENAME,
|
||||
BINARY_FOLDER,
|
||||
BINARY_PATH,
|
||||
BINARY_URL,
|
||||
CURRENT_TUNNELS,
|
||||
)
|
||||
from gradio.utils import (
|
||||
GRADIO_VERSION,
|
||||
TupleNoPrint,
|
||||
@ -1928,7 +1935,17 @@ Received outputs:
|
||||
analytics.error_analytics("Not able to set up tunnel")
|
||||
self.share_url = None
|
||||
self.share = False
|
||||
print(strings.en["COULD_NOT_GET_SHARE_LINK"].format(BINARY_PATH))
|
||||
if Path(BINARY_PATH).exists():
|
||||
print(strings.en["COULD_NOT_GET_SHARE_LINK"])
|
||||
else:
|
||||
print(
|
||||
strings.en["COULD_NOT_GET_SHARE_LINK_MISSING_FILE"].format(
|
||||
BINARY_PATH,
|
||||
BINARY_URL,
|
||||
BINARY_FILENAME,
|
||||
BINARY_FOLDER,
|
||||
)
|
||||
)
|
||||
else:
|
||||
if not (quiet):
|
||||
print(strings.en["PUBLIC_SHARE_TRUE"])
|
||||
|
@ -12,7 +12,8 @@ en = {
|
||||
"RUNNING_LOCALLY": "Running on local URL: {}",
|
||||
"RUNNING_LOCALLY_SEPARATED": "Running on local URL: {}://{}:{}",
|
||||
"SHARE_LINK_DISPLAY": "Running on public URL: {}",
|
||||
"COULD_NOT_GET_SHARE_LINK": "\nCould not create share link. Please check your internet connection or our status page: https://status.gradio.app. \n\nAlso please ensure that your antivirus or firewall is not blocking the binary file located at: {}",
|
||||
"COULD_NOT_GET_SHARE_LINK": "\nCould not create share link. Please check your internet connection or our status page: https://status.gradio.app.",
|
||||
"COULD_NOT_GET_SHARE_LINK_MISSING_FILE": "\nCould not create share link. Missing file: {}. \n\nPlease check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps: \n\n1. Download this file: {}\n2. Rename the downloaded file to: {}\n3. Move the file to this location: {}",
|
||||
"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()`.",
|
||||
"MODEL_PUBLICLY_AVAILABLE_URL": "Model available publicly at: {} (may take up to a minute for link to be usable)",
|
||||
|
@ -16,11 +16,13 @@ machine = platform.machine()
|
||||
if machine == "x86_64":
|
||||
machine = "amd64"
|
||||
|
||||
# Check if the file exist
|
||||
BINARY_NAME = f"frpc_{platform.system().lower()}_{machine.lower()}"
|
||||
BINARY_FILENAME = f"{BINARY_NAME}_v{VERSION}"
|
||||
BINARY_PATH = f"{Path(__file__).parent / BINARY_FILENAME}"
|
||||
BINARY_REMOTE_NAME = f"frpc_{platform.system().lower()}_{machine.lower()}"
|
||||
EXTENSION = ".exe" if os.name == "nt" else ""
|
||||
BINARY_URL = f"https://cdn-media.huggingface.co/frpc-gradio-{VERSION}/{BINARY_REMOTE_NAME}{EXTENSION}"
|
||||
|
||||
BINARY_FILENAME = f"{BINARY_REMOTE_NAME}_v{VERSION}"
|
||||
BINARY_FOLDER = Path(__file__).parent
|
||||
BINARY_PATH = f"{BINARY_FOLDER / BINARY_FILENAME}"
|
||||
|
||||
|
||||
class Tunnel:
|
||||
@ -36,8 +38,7 @@ class Tunnel:
|
||||
@staticmethod
|
||||
def download_binary():
|
||||
if not Path(BINARY_PATH).exists():
|
||||
binary_url = f"https://cdn-media.huggingface.co/frpc-gradio-{VERSION}/{BINARY_NAME}{EXTENSION}"
|
||||
resp = requests.get(binary_url)
|
||||
resp = requests.get(BINARY_URL)
|
||||
|
||||
if resp.status_code == 403:
|
||||
raise OSError(
|
||||
|
Loading…
x
Reference in New Issue
Block a user