ultralytics 8.1.2 scope HUB-SDK imports (#7596)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-01-15 23:48:20 +01:00 committed by GitHub
parent b1282544d2
commit 5f5f5d08f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 20 deletions

View file

@ -1,12 +1,11 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
import requests
from hub_sdk import HUB_API_ROOT, HUB_WEB_ROOT, HUBClient
from ultralytics.data.utils import HUBDatasetStats
from ultralytics.hub.auth import Auth
from ultralytics.hub.utils import PREFIX
from ultralytics.utils import LOGGER, SETTINGS
from ultralytics.hub.utils import HUB_API_ROOT, HUB_WEB_ROOT, PREFIX
from ultralytics.utils import LOGGER, SETTINGS, checks
def login(api_key: str = None, save=True) -> bool:
@ -21,6 +20,9 @@ def login(api_key: str = None, save=True) -> bool:
Returns:
bool: True if authentication is successful, False otherwise.
"""
checks.check_requirements("hub-sdk>=0.0.2")
from hub_sdk import HUBClient
api_key_url = f"{HUB_WEB_ROOT}/settings?tab=api+keys" # set the redirect URL
saved_key = SETTINGS.get("api_key")
active_key = api_key or saved_key