Skip to content

Commit e74257f

Browse files
committed
Fix #15
1 parent 95556b1 commit e74257f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rapid_layout/utils/infer_engine.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# @Author: SWHL
33
# @Contact: [email protected]
44
import os
5-
import platform
5+
import sys
66
import traceback
77
from enum import Enum
88
from pathlib import Path
@@ -132,16 +132,16 @@ def _check_dml(self) -> bool:
132132
if not self.cfg_use_dml:
133133
return False
134134

135-
cur_os = platform.system()
136-
if cur_os != "Windows":
135+
if sys.platform != "win32":
137136
self.logger.warning(
138-
"DirectML is only supported in Windows OS. The current OS is %s. Use %s inference by default.",
139-
cur_os,
137+
"DirectML is only supported in Windows OS. The current OS is %s. "
138+
"Refer to https://docs.python.org/3/library/sys.html#sys.platform for more details. Use %s inference by default.",
139+
sys.platform,
140140
self.had_providers[0],
141141
)
142142
return False
143143

144-
cur_window_version = int(platform.release().split(".")[0])
144+
cur_window_version = sys.getwindowsversion().major
145145
if cur_window_version < 10:
146146
self.logger.warning(
147147
"DirectML is only supported in Windows 10 and above OS. The current Windows version is %s. Use %s inference by default.",

0 commit comments

Comments
 (0)