Skip to content

Commit 1e253ff

Browse files
Fix test_subclass_conversion with numpy==2.x (#10297)
* numpy 2 * format * add changeset --------- Co-authored-by: gradio-pr-bot <[email protected]>
1 parent 135630e commit 1e253ff

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/purple-eels-bake.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gradio": patch
3+
---
4+
5+
fix:Fix test_subclass_conversion with numpy==2.x

gradio/processing_utils.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,13 @@ def _scale(a, n, m, copy=True):
928928

929929
image = np.asarray(image)
930930
dtypeobj_in = image.dtype
931-
dtypeobj_out = np.dtype("float64") if dtype is np.floating else np.dtype(dtype)
931+
dtypeobj_out = (
932+
dtypeobj_in
933+
if dtype is np.floating
934+
else np.dtype("float64")
935+
if dtype is float
936+
else np.dtype(dtype)
937+
)
932938
dtype_in = dtypeobj_in.type
933939
dtype_out = dtypeobj_out.type
934940
kind_in = dtypeobj_in.kind

0 commit comments

Comments
 (0)