-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compute visualization results from operators (#4324)
* add np casting to json encoder * isinstance * add test * add await
- Loading branch information
1 parent
ba743bd
commit 59139cf
Showing
2 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
FiftyOne Server decorators. | ||
| Copyright 2017-2024, Voxel51, Inc. | ||
| `voxel51.com <https://voxel51.com/>`_ | ||
| | ||
""" | ||
|
||
import unittest | ||
|
||
import numpy as np | ||
|
||
from fiftyone.server.decorators import create_response | ||
|
||
|
||
class TestNumPyResponse(unittest.IsolatedAsyncioTestCase): | ||
async def test_numpy_response(self): | ||
await create_response( | ||
{ | ||
"float16": np.array([16.0], dtype=np.float16), | ||
"float32": np.array([32.0], dtype=np.float32), | ||
"float64": np.array([64.0], dtype=np.float64), | ||
"int8": np.array([8], dtype=np.int8), | ||
"int16": np.array([8], dtype=np.int16), | ||
"int32": np.array([8], dtype=np.int32), | ||
"int64": np.array([8], dtype=np.int64), | ||
"uint8": np.array([8], dtype=np.uint8), | ||
"uint6": np.array([8], dtype=np.uint16), | ||
"uint32": np.array([8], dtype=np.uint32), | ||
"uint64": np.array([8], dtype=np.uint64), | ||
} | ||
) |