This commit is contained in:
		@@ -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)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user