mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 桌面端支持搜索图片 OCR 文本 https://github.com/siyuan-note/siyuan/issues/3470
This commit is contained in:
parent
15cd499f56
commit
0e5d2dc87c
1 changed files with 6 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -117,8 +118,12 @@ func autoOCRAssets() {
|
||||||
assetsPath := GetDataAssetsAbsPath()
|
assetsPath := GetDataAssetsAbsPath()
|
||||||
assets := getUnOCRAssetsAbsPaths()
|
assets := getUnOCRAssetsAbsPaths()
|
||||||
|
|
||||||
|
poolSize := runtime.NumCPU()
|
||||||
|
if 4 < poolSize {
|
||||||
|
poolSize = 4
|
||||||
|
}
|
||||||
waitGroup := &sync.WaitGroup{}
|
waitGroup := &sync.WaitGroup{}
|
||||||
p, _ := ants.NewPoolWithFunc(4, func(arg interface{}) {
|
p, _ := ants.NewPoolWithFunc(poolSize, func(arg interface{}) {
|
||||||
defer waitGroup.Done()
|
defer waitGroup.Done()
|
||||||
|
|
||||||
assetAbsPath := arg.(string)
|
assetAbsPath := arg.(string)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue