in serverless-workflow-examples/serverless-workflow-openvino-quarkus/utils/notebook_utils.py [0:0]
def __init__(self, device: str):
"""
Show a warning message about an unavailable device. This class does not check whether or
not the device is available, use the `check_device` function to check this. `check_device`
also shows the warning if the device is not found.
:param device: The unavailable device.
:return: A formatted alert box with the message that `device` is not available, and a list
of devices that are available.
"""
ie = Core()
supported_devices = ie.available_devices
self.message = (
f"Running this cell requires a {device} device, "
"which is not available on this system. "
)
self.alert_class = "warning"
if len(supported_devices) == 1:
self.message += f"The following device is available: {ie.available_devices[0]}"
else:
self.message += (
"The following devices are available: " f"{', '.join(ie.available_devices)}"
)
super().__init__(self.message, self.alert_class)