Commit c02005d 1 parent d9ada95 commit c02005d Copy full SHA for c02005d
File tree 4 files changed +22
-8
lines changed
4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
1
# MBBank API for Python
2
- A unofficially light weight Python Api for the "Military Commercial Joint Stock Bank" personal account
2
+ A unofficially lightweight Python Api for the "Military Commercial Joint Stock Bank" personal account
3
3
4
4
## Why we have this lib ?
5
5
6
6
Because I don't want to lose money on some api services like [ casso.vn] ( https://casso.vn/ ) or [ payos.vn] ( https://payos.vn/ )
7
7
when have freemium tier but with limit :>
8
8
9
- what you need that it use this lib to make your own code so you can use it free forever
9
+ What you need that it use this lib to make your own code so you can use it free forever
10
10
11
11
[ Documentation & FAQ] ( http://mbbank.rtfd.io/ )
12
12
13
13
## Requires
14
- - [ pytorch with cuda] ( https://pytorch.org/get -started/locally/#start-locally ) (optional if you want to use cuda gpu)
14
+ - [ onnx with cuda] ( https://onnxruntime.ai/getting -started ) (optional if you want to use cuda gpu)
15
15
16
16
- python3
17
17
@@ -29,4 +29,6 @@ what you need that it use this lib to make your own code so you can use it free
29
29
30
30
- [ MBBank JS API] ( https://github.com/CookieGMVN/MBBank )
31
31
32
+ - [ MBBank OCR] ( https://github.com/thedtvn/mbbank-capcha-ocr )
33
+
32
34
![ Hits] ( https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fthedtvn%2FMBBank&count_bg=%2379C83D&title_bg=%23555555&icon=python.svg&icon_color=%23E7E7E7&title=Views+Counter&edge_flat=false )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ when have freemium tier but with limit :>
9
9
what you need that it use this lib to make your own code so you can use it free forever
10
10
11
11
## Requires
12
- - [ pytorch with cuda] ( https://pytorch.org/get -started/locally/#start-locally ) (optional if you want to use cuda gpu)
12
+ - [ onnx with cuda] ( https://onnxruntime.ai/getting -started ) (optional if you want to use cuda gpu)
13
13
14
14
- python3
15
15
@@ -35,4 +35,8 @@ These pages go into great detail about everything the API can do.
35
35
36
36
- Will my account get banned if i use this lib ?
37
37
38
- > I can not guarantee that so use it with your own risk.
38
+ > I can not guarantee that so use it with your own risk.
39
+
40
+ - Can i run ocr model on cpu ?
41
+
42
+ > Yes, you can. but it maybe will be slower than using gpu (cuda)
Original file line number Diff line number Diff line change 3
3
from .wasm_helper import wasm_encrypt
4
4
from .capcha_ocr import CapchaProcessing , CapchaOCR
5
5
6
- __version__ = '0.2.2 '
6
+ __version__ = '0.2.3 '
Original file line number Diff line number Diff line change 1
1
import io
2
- from mb_capcha_ocr import predict
2
+ from mb_capcha_ocr import OcrModel
3
3
from PIL import Image
4
4
5
5
@@ -34,8 +34,16 @@ class CapchaOCR(CapchaProcessing):
34
34
"""
35
35
Torch based OCR for capcha processing
36
36
https://pypi.org/project/mb-capcha-ocr/
37
+
38
+ Args:
39
+ model_path (str, optional): path to model file
37
40
"""
38
41
42
+ def __init__ (self , model_path : str = None ):
43
+ super ().__init__ ()
44
+ # loading model will take about 1-3 seconds
45
+ self .model = OcrModel (model_path )
46
+
39
47
def process_image (self , img : bytes ) -> str :
40
48
"""
41
49
Process image and return text
@@ -47,7 +55,7 @@ def process_image(self, img: bytes) -> str:
47
55
success (str): text from image
48
56
"""
49
57
image = Image .open (io .BytesIO (img ))
50
- text = predict (image )
58
+ text = self . model . predict (image )
51
59
return text
52
60
53
61
You can’t perform that action at this time.
0 commit comments