개정판 ed7877e8
issue #1366: symbol on going
Change-Id: I46c52d94e32e7d1cc5a6873bb8bd660ce9e8bbac
DTI_PID/WebServer/app.py | ||
---|---|---|
13 | 13 |
|
14 | 14 |
app = Flask(__name__) |
15 | 15 |
|
16 |
def recognition(params=None): |
|
17 |
if params[0] == 'Text Area': |
|
18 |
res = text_craft.get_text_box_batch(params[1:]) |
|
19 |
return ['Text Area', res] |
|
20 |
elif params[0] == 'Symbol': |
|
21 |
pass |
|
22 |
|
|
16 | 23 |
try: |
17 | 24 |
#from model import get_prediction, batch_prediction |
18 | 25 |
import text_craft |
... | ... | |
22 | 29 |
#import ctypes |
23 | 30 |
#ctypes.cdll.LoadLibrary('caffe2_nvrtc.dll') |
24 | 31 |
|
25 |
streamer = ThreadedStreamer(text_craft.get_text_box_batch, batch_size=64)
|
|
32 |
streamer = ThreadedStreamer(recognition, batch_size=64)
|
|
26 | 33 |
except ImportError as ex: |
27 | 34 |
ex |
28 | 35 |
pass |
... | ... | |
117 | 124 |
boxes_list = boxes |
118 | 125 |
''' |
119 | 126 |
|
120 |
infos = [[None, None, os.path.dirname(os.path.realpath(__file__)) + '\\CRAFT_pytorch_master\\weights\\craft_mlt_25k.pth', imgs]] |
|
127 |
infos = ['Text Area', [None, None, os.path.dirname(os.path.realpath(__file__)) + '\\CRAFT_pytorch_master\\weights\\craft_mlt_25k.pth', imgs]]
|
|
121 | 128 |
boxes = streamer.predict(infos) |
122 |
boxes_list = boxes[0] |
|
129 |
boxes_list = boxes[1][0]
|
|
123 | 130 |
|
124 | 131 |
return jsonify({'text_box_list': boxes_list}) |
125 | 132 |
|
내보내기 Unified diff