-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathwinml.py
More file actions
21 lines (19 loc) · 782 Bytes
/
winml.py
File metadata and controls
21 lines (19 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import json
def _get_ep_paths() -> dict[str, str]:
from winui3.microsoft.windows.applicationmodel.dynamicdependency.bootstrap import (
InitializeOptions,
initialize
)
import winui3.microsoft.windows.ai.machinelearning as winml
eps = {}
with initialize(options = InitializeOptions.ON_NO_MATCH_SHOW_UI):
catalog = winml.ExecutionProviderCatalog.get_default()
providers = catalog.find_all_providers()
for provider in providers:
provider.ensure_ready_async().get()
eps[provider.name] = provider.library_path
# DO NOT call provider.try_register in python. That will register to the native env.
return eps
if __name__ == "__main__":
eps = _get_ep_paths()
print(json.dumps(eps))