roboflow-python
roboflow-python copied to clipboard
fix: allow model.predict to handle numpy array inputs
Description
This PR adds support for numpy array inputs to the model.predict function, fixing issue #346. Previously, model.predict would fail when trying to process numpy array inputs in segmentation models, despite working with file paths. This change enables consistent behavior across all input types.
Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
How has this change been tested, please provide a testcase or example of how you tested the change?
Added comprehensive unit tests in test_instance_segmentation.py:
- Test with basic numpy array image
- Verify prediction group output
- Validate request formatting
- Check API response handling
Example test case:
image_array = np.zeros((100, 100, 3), dtype=np.uint8)
image_array[30:70, 30:70] = 255
result = model.predict(image_array)
Docs
- [ ] Updated function docstring to include numpy array type