From 2fe26935c9eb6838d6c58f3a81894cce5495ec4e Mon Sep 17 00:00:00 2001 From: Gert Mertes Date: Fri, 5 Apr 2024 10:42:36 +0000 Subject: [PATCH] Update remote api url --- ai_models/__main__.py | 2 +- ai_models/remote/api.py | 5 ++++- ai_models/remote/config.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ai_models/__main__.py b/ai_models/__main__.py index e97caff..f75e548 100644 --- a/ai_models/__main__.py +++ b/ai_models/__main__.py @@ -239,7 +239,7 @@ def _main(argv): if len(models) == 0: print(f"No remote models available on {api.url}") sys.exit(0) - print(f"Models available on remote server {api.url}:") + print(f"Models available on remote server {api.url}") else: models = available_models() diff --git a/ai_models/remote/api.py b/ai_models/remote/api.py index cf5d64e..5f60eb7 100644 --- a/ai_models/remote/api.py +++ b/ai_models/remote/api.py @@ -35,6 +35,9 @@ def __init__( self.url = ( url or os.getenv("AI_MODELS_REMOTE_URL") or config.get("url") or API_URL ) + if not self.url.endswith("/"): + self.url += "/" + self.token = token or os.getenv("AI_MODELS_REMOTE_TOKEN") or config.get("token") if not self.token: @@ -66,7 +69,7 @@ def run(self, cfg: dict): # submit task data = self._request(requests.post, data["href"], json=cfg) - LOG.info("Request submitted") + LOG.info("Inference request submitted") if data["status"] != "queued": LOG.error(data["status"]) diff --git a/ai_models/remote/config.py b/ai_models/remote/config.py index 47667cb..61af0d3 100644 --- a/ai_models/remote/config.py +++ b/ai_models/remote/config.py @@ -1,7 +1,7 @@ import logging import os -API_URL = "https://ai-models.ecmwf.int" +API_URL = "https://ai-models.ecmwf.int/api/v1/" ROOT_PATH = os.path.join(os.path.expanduser("~"), ".config", "ai-models") CONFIG_PATH = os.path.join(ROOT_PATH, "api.yaml")