mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-15 00:51:10 +08:00
Opt: Avoid importing OCR models on client when UseOcrServer is enable
This commit is contained in:
@@ -99,17 +99,20 @@ def release_resources(next_task=''):
|
|||||||
# Release all OCR models
|
# Release all OCR models
|
||||||
# Usually to have 2 models loaded and each model takes about 20MB
|
# Usually to have 2 models loaded and each model takes about 20MB
|
||||||
# This will release 20-40MB
|
# This will release 20-40MB
|
||||||
from module.ocr.ocr import OCR_MODEL
|
from module.webui.setting import State
|
||||||
if 'Opsi' in next_task or 'commission' in next_task:
|
if not State.deploy_config.UseOcrServer:
|
||||||
# OCR models will be used soon, don't release
|
# Release only when using per-instance OCR
|
||||||
models = []
|
from module.ocr.ocr import OCR_MODEL
|
||||||
elif next_task:
|
if 'Opsi' in next_task or 'commission' in next_task:
|
||||||
# Release OCR models except 'azur_lane'
|
# OCR models will be used soon, don't release
|
||||||
models = ['cnocr', 'jp', 'tw']
|
models = []
|
||||||
else:
|
elif next_task:
|
||||||
models = ['azur_lane', 'cnocr', 'jp', 'tw']
|
# Release OCR models except 'azur_lane'
|
||||||
for model in models:
|
models = ['cnocr', 'jp', 'tw']
|
||||||
del_cached_property(OCR_MODEL, model)
|
else:
|
||||||
|
models = ['azur_lane', 'cnocr', 'jp', 'tw']
|
||||||
|
for model in models:
|
||||||
|
del_cached_property(OCR_MODEL, model)
|
||||||
|
|
||||||
# Release assets cache
|
# Release assets cache
|
||||||
# module.ui has about 80 assets and takes about 3MB
|
# module.ui has about 80 assets and takes about 3MB
|
||||||
|
|||||||
Reference in New Issue
Block a user