forked from smileboywtu/MillionHeroAssistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
34 lines (23 loc) · 778 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from config import default_answer_number
from core.baiduzhidao import zhidao_search
from core.nlp import get_summary
class OcrTestCase(TestCase):
"""unittest"""
def test_baidu_ocr(self):
"""
test baidu ocr
:return:
"""
from core.ocr.baiduocr import get_text_from_image
print("test baidu ocr")
app_id = "10661627"
app_key = "h5xcL0m4TB8fiiFWoysn7uxt"
app_secret = "HGA1cgXzz80douKQUpII7K77TYWSGcfW"
with open("screenshots/text_area.png", "rb") as fp:
message = get_text_from_image(fp.read(), app_id, app_key, app_secret, 5)
print(message)
if __name__ == "__main__":
unittest.main()