File tree 1 file changed +3
-18
lines changed
1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -30,26 +30,13 @@ class OCR extends Operation {
30
30
this . infoURL = "https://en.wikipedia.org/wiki/Optical_character_recognition" ;
31
31
this . inputType = "ArrayBuffer" ;
32
32
this . outputType = "string" ;
33
- this . args = [
34
- /* Example arguments. See the project wiki for full details.
35
- {
36
- name: "First arg",
37
- type: "string",
38
- value: "Don't Panic"
39
- },
40
- {
41
- name: "Second arg",
42
- type: "number",
43
- value: 42
44
- }
45
- */
46
- ] ;
33
+ this . args = [ ] ;
47
34
}
48
35
49
36
/**
50
37
* @param {ArrayBuffer } input
51
38
* @param {Object[] } args
52
- * @returns {Object }
39
+ * @returns {string }
53
40
*/
54
41
async run ( input , args ) {
55
42
if ( ! isImage ( input ) ) {
@@ -72,11 +59,9 @@ class OCR extends Operation {
72
59
73
60
const result = await worker . recognize ( image )
74
61
. progress ( progress => {
75
- if ( isWorkerEnvironment ( ) ) self . sendStatusMessage ( `${ progress . status } - ${ parseFloat ( progress . progress ) . toFixed ( 2 ) } %` ) ;
62
+ if ( isWorkerEnvironment ( ) ) self . sendStatusMessage ( `${ progress . status } - ${ ( parseFloat ( progress . progress ) * 100 ) . toFixed ( 2 ) } %` ) ;
76
63
} ) ;
77
64
78
- console . log ( result ) ;
79
-
80
65
return result . text ;
81
66
} catch ( err ) {
82
67
throw new OperationError ( `Error performing OCR on image. (${ err } )` ) ;
You can’t perform that action at this time.
0 commit comments