Removed hard-coded urls
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Pünkösd Marcell 2021-07-27 17:44:14 +02:00
parent c757b838dd
commit 439a3faed6
1 changed files with 8 additions and 3 deletions

View File

@ -4,12 +4,15 @@ import logging
import tempfile
import requests
import time
from urllib.parse import urljoin
from classifier_cache import ClassifierCache
class MagicDoer:
classifier_cache = ClassifierCache()
classifier_cache = ClassifierCache(
os.environ.get("MODEL_INFO_URL", "http://model-service/model/cnn/$default")
)
@classmethod
def run_everything(cls, parameters: dict) -> dict:
@ -19,9 +22,11 @@ class MagicDoer:
try:
# Download Sample
storage_service_url = os.environ.get("STORAGE_SERVICE_URL", "http://storage-service/")
object_path = urljoin(storage_service_url, f"object/{tag}")
logging.info(f"Downloading sample: {tag}")
r = requests.get(f"http://storage-service/object/{tag}")
logging.info(f"Downloading sample: {tag} from {object_path}")
r = requests.get(object_path)
with open(sample_file_handle, 'wb') as f:
f.write(r.content)