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/c8fa85e07a8b10094e2b4a4eaf42339f236ce65f/tests/test_ml_utils.py
- Command line
-
hf download hf://spaces/cvachet/object_detection_lambda@c8fa85e07a8b10094e2b4a4eaf42339f236ce65f/tests/test_ml_utils.py
-
curl -L -o test_ml_utils.py https://huggingface.co/spaces/cvachet/object_detection_lambda/resolve/c8fa85e07a8b10094e2b4a4eaf42339f236ce65f/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 | |