Spaces:
Sleeping
Sleeping
Download tests/test_ml_utils.py from cvachet/object_detection_lambda: direct link, hf CLI and curl.
- Browser
- Download file 309 Bytes
-
https://huggingface.co/spaces/cvachet/object_detection_lambda/resolve/a5ac89c3aad0ca7f80da8a5dfe3ef8649f3bdf18/tests/test_ml_utils.py
- Command line
-
hf download hf://spaces/cvachet/object_detection_lambda@a5ac89c3aad0ca7f80da8a5dfe3ef8649f3bdf18/tests/test_ml_utils.py
-
curl -L -o test_ml_utils.py https://huggingface.co/spaces/cvachet/object_detection_lambda/resolve/a5ac89c3aad0ca7f80da8a5dfe3ef8649f3bdf18/tests/test_ml_utils.py
309 Bytes
| from detection import ml_utils | |
| import torch | |
| import json | |
| # Test dictionary conversion | |
| def test_convert_tensor_dict_to_json(): | |
| my_dict = {'scores': torch.tensor([1, 2, 3])} | |
| my_list_gt = {'scores': [1, 2, 3]} | |
| my_list = ml_utils.convert_tensor_dict_to_json(my_dict) | |
| assert my_list == my_list_gt | |