@@ -39,7 +39,7 @@ class BlockManifest(WorkflowBlockManifest):
3939    model_config  =  ConfigDict (
4040        json_schema_extra = {
4141            "name" : "Load Image From URL" ,
42-             "version" : "v1" ,  
42+             "version" : "v1" ,
4343            "short_description" : "Load an image from a URL." ,
4444            "long_description" : LONG_DESCRIPTION ,
4545            "license" : "Apache-2.0" ,
@@ -54,12 +54,12 @@ class BlockManifest(WorkflowBlockManifest):
5454    type : Literal ["roboflow_core/load_image_from_url@v1" ]
5555    url : Union [str , Selector (kind = [STRING_KIND ])] =  Field (
5656        description = "URL of the image to load" ,
57-         examples = ["https://example.com/image.jpg" , "$inputs.image_url" ]
57+         examples = ["https://example.com/image.jpg" , "$inputs.image_url" ], 
5858    )
5959    cache : Union [bool , Selector (kind = [BOOLEAN_KIND ])] =  Field (
6060        default = True ,
6161        description = "Whether to cache the downloaded image to avoid re-fetching" ,
62-         examples = [True , False , "$inputs.cache_image" ]
62+         examples = [True , False , "$inputs.cache_image" ], 
6363    )
6464
6565    @classmethod  
@@ -82,29 +82,28 @@ def run(self, url: str, cache: bool = True, **kwargs) -> BlockResult:
8282        try :
8383            # Generate cache key using URL hash (following common pattern) 
8484            cache_key  =  hashlib .md5 (url .encode ("utf-8" )).hexdigest ()
85-              
85+ 
8686            # Check cache if enabled 
8787            if  cache :
8888                cached_image  =  image_cache .get (cache_key )
8989                if  cached_image  is  not None :
9090                    return  {"image" : cached_image }
91-              
91+ 
9292            # Load image using secure utility 
9393            numpy_image  =  load_image_from_url (value = url )
94-              
94+ 
9595            # Create proper parent metadata 
9696            parent_metadata  =  ImageParentMetadata (parent_id = str (uuid4 ()))
97-              
97+ 
9898            workflow_image  =  WorkflowImageData (
9999                parent_metadata = parent_metadata ,
100100                numpy_image = numpy_image ,
101101            )
102-              
102+ 
103103            # Store in cache if enabled 
104104            if  cache :
105105                image_cache .set (cache_key , workflow_image )
106-              
106+ 
107107            return  {"image" : workflow_image }
108108        except  Exception  as  e :
109109            raise  RuntimeError (f"Failed to load image from URL { url } { str (e )}  )
110-     
0 commit comments