(config: { cwd: string; config_name: string })
| 98 | } |
| 99 | |
| 100 | setUp(config: { cwd: string; config_name: string }) { |
| 101 | if (!examToken(config)) { |
| 102 | return; |
| 103 | } |
| 104 | const { cwd, config_name } = config; |
| 105 | this.worker = new PPOCRWorker( |
| 106 | "PaddleOCR_json.exe", |
| 107 | [`--config_path=${config_name}`], |
| 108 | { |
| 109 | cwd: cwd, |
| 110 | }, |
| 111 | false |
| 112 | ); |
| 113 | this.worker.on("error", () => { |
| 114 | this.worker = null; |
| 115 | console.log("PP OCR初始化失败"); |
| 116 | logger.toast("PP OCR initialize fail.", true); |
| 117 | }); |
| 118 | } |
| 119 | |
| 120 | onExit() { |
| 121 | if (this.enabled()) { |