|
@@ -1,55 +1,56 @@
|
|
import unittest
|
|
import unittest
|
|
import base64
|
|
import base64
|
|
import requests
|
|
import requests
|
|
-
|
|
|
|
-url = 'http://localhost:8080'
|
|
|
|
|
|
+from pathlib import Path
|
|
|
|
+url = 'http://192.168.199.107:18099'
|
|
|
|
|
|
|
|
|
|
def send_request(image_path):
|
|
def send_request(image_path):
|
|
with open(image_path, 'rb') as f:
|
|
with open(image_path, 'rb') as f:
|
|
img_str: str = base64.encodebytes(f.read()).decode('utf-8')
|
|
img_str: str = base64.encodebytes(f.read()).decode('utf-8')
|
|
- r = requests.post(f'{url}/ocr_system/table', json={'image': img_str})
|
|
|
|
|
|
+ r = requests.post(f'{url}/ocr_system/table', json={'image': img_str, 'det': 'conv'})
|
|
print(r.json())
|
|
print(r.json())
|
|
return r.json()
|
|
return r.json()
|
|
|
|
|
|
|
|
|
|
class TestTableOcr(unittest.TestCase):
|
|
class TestTableOcr(unittest.TestCase):
|
|
- def test_it_work(self):
|
|
|
|
- pong = requests.request("GET", '/'.join([url, 'ping']))
|
|
|
|
- self.assertEqual('"pong!"', pong.text, 'Not work')
|
|
|
|
|
|
+ # def test_it_work(self):
|
|
|
|
+ # pong = requests.request("GET", '/'.join([url, 'ping']))
|
|
|
|
+ # self.assertEqual('"pong!"', pong.text, 'Not work')
|
|
|
|
|
|
def test_table_01(self):
|
|
def test_table_01(self):
|
|
print("被旋转的图片")
|
|
print("被旋转的图片")
|
|
- res = send_request('./images/01.jpeg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
-
|
|
|
|
- def test_table_02(self):
|
|
|
|
- res = send_request('./images/02.jpg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
-
|
|
|
|
- def test_table_03(self):
|
|
|
|
- res = send_request('./images/03.jpg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
-
|
|
|
|
- def test_table_04(self):
|
|
|
|
- res = send_request('./images/04.jpg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
-
|
|
|
|
- def test_table_05(self):
|
|
|
|
- res = send_request('./images/05.jpeg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
-
|
|
|
|
- def test_table_06(self):
|
|
|
|
- res = send_request('./images/06.jpeg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
-
|
|
|
|
- def test_table_07(self):
|
|
|
|
- res = send_request('./images/07.jpeg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
-
|
|
|
|
- def test_table_08(self):
|
|
|
|
- res = send_request('./images/08.jpg')
|
|
|
|
- self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
|
|
+ fn = Path(__file__).parent / '../images/01.jpeg'
|
|
|
|
+ res = send_request(fn)
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
+ #
|
|
|
|
+ # def test_table_02(self):
|
|
|
|
+ # res = send_request('./images/02.jpg')
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
+ #
|
|
|
|
+ # def test_table_03(self):
|
|
|
|
+ # res = send_request('./images/03.jpg')
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
+ #
|
|
|
|
+ # def test_table_04(self):
|
|
|
|
+ # res = send_request('./images/04.jpg')
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
+ #
|
|
|
|
+ # def test_table_05(self):
|
|
|
|
+ # res = send_request('./images/05.jpeg')
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
+ #
|
|
|
|
+ # def test_table_06(self):
|
|
|
|
+ # res = send_request('./images/06.jpeg')
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
+ #
|
|
|
|
+ # def test_table_07(self):
|
|
|
|
+ # res = send_request('./images/07.jpeg')
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
+ #
|
|
|
|
+ # def test_table_08(self):
|
|
|
|
+ # res = send_request('./images/08.jpg')
|
|
|
|
+ # self.assertEqual('000', res['status'], 'Not work')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
unittest.main()
|
|
unittest.main()
|