Open
Conversation
5bc8798 to
fb5726e
Compare
- Add LoadImageFromUrlBlockV1 transformation block - Support Union types for URL and cache inputs (direct values + parameters) - Implement LRU cache for image storage - Use existing load_image_from_url for security/validation - Add comprehensive test suite (17 tests, 100% requirement coverage) - Update block icon from fa-download to fa-image - Register block in workflow loader 🤖 Generated with [Claude Code](https://claude.ai/code)
- Fix black formatting issues in load_image_from_url/v1.py - Fix import sorting in loader.py 🤖 Generated with [Claude Code](https://claude.ai/code)
fb5726e to
3fd90b7
Compare
- Add LoadImageFromUrlBlockV1 transformation block - Support Union types for URL and cache inputs (direct values + parameters) - Implement LRU cache for image storage - Use existing load_image_from_url for security/validation - Add comprehensive test suite (17 tests, 100% requirement coverage) - Update block icon from fa-download to fa-image - Register block in workflow loader 🤖 Generated with [Claude Code](https://claude.ai/code)
- Fix black formatting issues in load_image_from_url/v1.py - Fix import sorting in loader.py 🤖 Generated with [Claude Code](https://claude.ai/code)
3fd90b7 to
3d2989b
Compare
…github.com/roboflow/inference into feature-load-image-from-url-workflow-block
yeldarby
requested changes
Aug 20, 2025
Contributor
yeldarby
left a comment
There was a problem hiding this comment.
Working for loading image & passing to some blocks but Model blocks seem to require a Batch oriented image & can't figure out how to modify this in a way that tells the execution engine that it's properly batched.
4 tasks
codeflash-ai bot
added a commit
that referenced
this pull request
Aug 26, 2025
…-image-from-url-workflow-block`) The optimization applies **module-level pre-computation** to eliminate repeated list construction. The original code creates a new 122-element list every time `load_blocks()` is called, while the optimized version creates the list once at import time and stores it in a module constant `_BLOCKS`. **Key changes:** - **Pre-computed constant**: The block list is moved to module-level constant `_BLOCKS`, constructed once during import - **Direct return**: `load_blocks()` now simply returns the pre-built list instead of constructing it each call **Why this achieves 713% speedup:** - **Eliminates list construction overhead**: The original spends ~80% of execution time (14.9ms out of 18.7ms) just constructing the list literal with 122 class references - **Reduces memory allocations**: No repeated list object creation on each function call - **Maintains object reference semantics**: Same classes are returned, preserving all behavior and type information **Test case performance patterns:** The optimization shows consistent 600-900% speedup across all test scenarios, with particularly strong gains in: - Repeated calls (784-936% faster) - benefits most from avoiding re-construction - Large-scale operations that call `load_blocks()` multiple times - Basic functionality tests (615-762% faster) - all benefit from the single list return This is a classic **constant folding** optimization where expensive computation (list construction) is moved from runtime to import time.
Contributor
⚡️ Codeflash found optimizations for this PR📄 714% (7.14x) speedup for
|
Collaborator
|
@Grantimus9 still workgin on this? I think the required changes in execution engine laded. Any other blockers or maybe we just need to merge in latest master and test? |
Contributor
Author
|
Just merge and test. Don't wait on me, but I'm also happy to do it later, probably tomorrow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a new workflow block that loads images from URLs with caching capabilities. This block enables workflows to dynamically fetch images from web URLs and use them as input for other workflow steps.
Features
$inputs.image_url)load_image_from_urlfunction for URL validation and secure image loadingImplementation Details
roboflow_core/load_image_from_url@v1url: Image URL (string or parameter reference)cache: Enable/disable caching (boolean or parameter reference, defaults totrue)image- WorkflowImageData object ready for use in other workflow stepsfas fa-imagefor visual identificationTesting
Files Added/Modified
inference/core/workflows/core_steps/transformations/load_image_from_url/v1.py- Main implementationinference/core/workflows/core_steps/transformations/load_image_from_url/__init__.py- Module initializationtests/workflows/unit_tests/core_steps/transformations/test_load_image_from_url.py- Test suiteinference/core/workflows/core_steps/loader.py- Block registration🤖 Generated with Claude Code