瀏覽代碼

Fixed linting issues

mshwed 5 年之前
父節點
當前提交
8dde732514
共有 1 個文件被更改,包括 3 次插入18 次删除
  1. 3 18
      src/core/operations/OCR.mjs

+ 3 - 18
src/core/operations/OCR.mjs

@@ -30,26 +30,13 @@ class OCR extends Operation {
         this.infoURL = "https://en.wikipedia.org/wiki/Optical_character_recognition";
         this.inputType = "ArrayBuffer";
         this.outputType = "string";
-        this.args = [
-            /* Example arguments. See the project wiki for full details.
-            {
-                name: "First arg",
-                type: "string",
-                value: "Don't Panic"
-            },
-            {
-                name: "Second arg",
-                type: "number",
-                value: 42
-            }
-            */
-        ];
+        this.args = [];
     }
 
     /**
      * @param {ArrayBuffer} input
      * @param {Object[]} args
-     * @returns {Object}
+     * @returns {string}
      */
     async run(input, args) {
         if (!isImage(input)) {
@@ -72,11 +59,9 @@ class OCR extends Operation {
 
             const result = await worker.recognize(image)
                 .progress(progress => {
-                    if (isWorkerEnvironment()) self.sendStatusMessage(`${progress.status} - ${parseFloat(progress.progress).toFixed(2)}%`);
+                    if (isWorkerEnvironment()) self.sendStatusMessage(`${progress.status} - ${(parseFloat(progress.progress)*100).toFixed(2)}%`);
                 });
 
-            console.log(result);
-
             return result.text;
         } catch (err) {
             throw new OperationError(`Error performing OCR on image. (${err})`);