Files
openvino/samples/python/hello_query_device/hello_query_device.py
Anastasia Kuporosova f9c0e9690a Akup/cherry pick samples namespace update (#19478)
* Fix samples debug

* Fix linter

* Fix speech sample

---------

Co-authored-by: p-wysocki <przemyslaw.wysocki@intel.com>
2023-08-29 14:48:54 +02:00

45 lines
1.6 KiB
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import sys
import openvino as ov
def param_to_string(parameters) -> str:
"""Convert a list / tuple of parameters returned from IE to a string."""
if isinstance(parameters, (list, tuple)):
return ', '.join([str(x) for x in parameters])
else:
return str(parameters)
def main():
log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.INFO, stream=sys.stdout)
# --------------------------- Step 1. Initialize OpenVINO Runtime Core --------------------------------------------
core = ov.Core()
# --------------------------- Step 2. Get metrics of available devices --------------------------------------------
log.info('Available devices:')
for device in core.available_devices:
log.info(f'{device} :')
log.info('\tSUPPORTED_PROPERTIES:')
for property_key in core.get_property(device, 'SUPPORTED_PROPERTIES'):
if property_key not in ('SUPPORTED_METRICS', 'SUPPORTED_CONFIG_KEYS', 'SUPPORTED_PROPERTIES'):
try:
property_val = core.get_property(device, property_key)
except TypeError:
property_val = 'UNSUPPORTED TYPE'
log.info(f'\t\t{property_key}: {param_to_string(property_val)}')
log.info('')
# -----------------------------------------------------------------------------------------------------------------
return 0
if __name__ == '__main__':
sys.exit(main())