Skip to content

Commit

Permalink
Fix test_subclass_conversion with numpy==2.x (#10297)
Browse files Browse the repository at this point in the history
* numpy 2

* format

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
abidlabs and gradio-pr-bot authored Jan 7, 2025
1 parent 135630e commit 1e253ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/purple-eels-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:Fix test_subclass_conversion with numpy==2.x
8 changes: 7 additions & 1 deletion gradio/processing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,13 @@ def _scale(a, n, m, copy=True):

image = np.asarray(image)
dtypeobj_in = image.dtype
dtypeobj_out = np.dtype("float64") if dtype is np.floating else np.dtype(dtype)
dtypeobj_out = (
dtypeobj_in
if dtype is np.floating
else np.dtype("float64")
if dtype is float
else np.dtype(dtype)
)
dtype_in = dtypeobj_in.type
dtype_out = dtypeobj_out.type
kind_in = dtypeobj_in.kind
Expand Down

0 comments on commit 1e253ff

Please sign in to comment.