-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
13 lines (10 loc) · 5.92 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
import ddddocr
from urllib.request import urlretrieve
ocr = ddddocr.DdddOcr()
img_url= 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABeAPADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3+iis/wCyX39u/avt3+g+Vs+y7f4/72aANCiiigAooooAKwfEWivfTWep2MMLatYFvskkxO2MPw/5jit6s/VLu+tfs32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xtb3yvtUEcvlOHTeM7WHcVYoAxrXwrotoQ0djGzj+Jxk1Z1C+sNBsGu7hRFApAJjTPU4HArQproki7XVWX0YZFAAjiSNXX7rAEfSnU103xMgJXKkZHaqekab/ZWnpafaZrnaSfMmbLHJoAvUUUUAFIzqilnYKB3JxXIaJ4j1Hxjpg1DRxDZ2jnCm4BMuPoMj9a0l8MrcEPqd7cXbf3S21fyFAE914l0y2bYJjPJ/chG8/pVY6nrd9xY6aIEPSS5bH6Vr2un2dkgW2to4wP7q1ZoA58aDfXnOp6rK4PWOD5F/xq/aaHptkcxWqb+7uNxP4mtGigCvLYWk1zDcyW8bTQZ8pyvKZ64qxTZAzRsqNtYggH0NU9Itb2z09Ib+8+13AJJl27cjPHFAF6iiigAoorF1LxJbaZ4m0TQpYZXuNY8/yZFxtTykDtu5zyDxjP4UAbVFFFABRRRQAUUUUAFMEMQlMojQSHgsFGT+NPooAzdZ0HTfEFqlvqdss8SOHUHsw71oIixxqijCqAAPanUUAFFFFABRRRQAUUUUAFFFFAH//Z'
file_name = 'cd.jpeg'
urlretrieve(img_url, file_name)
with open('cd.jpeg', 'rb') as f:
img_data = f.read()
ret = ocr.classification(img_data)
print(ret)