generated from MaaXYZ/MaaPracticeBoilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.py
More file actions
28 lines (20 loc) · 775 Bytes
/
configure.py
File metadata and controls
28 lines (20 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from pathlib import Path
import shutil
assets_dir = Path(__file__).parent.resolve() / "assets"
def configure_ocr_model():
assets_ocr_dir = assets_dir / "MaaCommonAssets" / "OCR"
if not assets_ocr_dir.exists():
print(f"File Not Found: {assets_ocr_dir}")
exit(1)
ocr_dir = assets_dir / "resource" / "model" / "ocr"
if not ocr_dir.exists(): # copy default OCR model only if dir does not exist
shutil.copytree(
assets_dir / "MaaCommonAssets" / "OCR" / "ppocr_v5" / "zh_cn",
ocr_dir,
dirs_exist_ok=True,
)
else:
print("Found existing OCR directory, skipping default OCR model import.")
if __name__ == "__main__":
configure_ocr_model()
print("OCR model configured.")