Denver Citizen9
updated - how big of an example?
b04c40f
raw
history blame
54.9 kB
import gradio as gr
def process_json(json_data):
# Function implementation to process the JSON data
# You can replace this with your actual logic
return f"Processed JSON data: {json_data}"
def launch_demo():
default_example = """{
\"base64\" : \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAg...\" ,
\"result\" : [
{
\"save_path\" : \"\" ,
\"data\" : [
{
\"text\" : \"LOCAL\" ,
\"confidence\" : 0.8618108630180359 ,
\"text_box_position\" : [
[
261 ,
150
],
[
446 ,
150
],
[
446 ,
181
],
[
261 ,
181
]
]
},
{
\"text\" : \"123 Streetname St.\" ,
\"confidence\" : 0.9439226984977722 ,
\"text_box_position\" : [
[
502 ,
184
],
[
882 ,
184
],
[
882 ,
228
],
[
502 ,
228
]
]
},
{
\"text\" : \"ABLEBLL\" ,
\"confidence\" : 0.7617589235305786 ,
\"text_box_position\" : [
[
1269 ,
190
],
[
2157 ,
190
],
[
2157 ,
265
],
[
1269 ,
265
]
]
},
{
\"text\" : \"Hometown, Statename\" ,
\"confidence\" : 0.9520577788352966 ,
\"text_box_position\" : [
[
496 ,
234
],
[
955 ,
237
],
[
954 ,
281
],
[
496 ,
277
]
]
},
{
\"text\" : \"ZIPCODE\" ,
\"confidence\" : 0.9398264288902283 ,
\"text_box_position\" : [
[
499 ,
284
],
[
703 ,
284
],
[
703 ,
327
],
[
499 ,
327
]
]
},
{
\"text\" : \"BILLING NUMBER:\" ,
\"confidence\" : 0.9517545104026794 ,
\"text_box_position\" : [
[
1272 ,
337
],
[
1605 ,
337
],
[
1605 ,
377
],
[
1272 ,
377
]
]
},
{
\"text\" : \"000123\" ,
\"confidence\" : 0.8625118136405945 ,
\"text_box_position\" : [
[
1780 ,
337
],
[
1934 ,
337
],
[
1934 ,
380
],
[
1780 ,
380
]
]
},
{
\"text\" : \"CABLE\" ,
\"confidence\" : 0.9522758722305298 ,
\"text_box_position\" : [
[
261 ,
390
],
[
443 ,
390
],
[
443 ,
433
],
[
261 ,
433
]
]
},
{
\"text\" : \"BILLING DATE:\" ,
\"confidence\" : 0.9346808791160583 ,
\"text_box_position\" : [
[
1272 ,
412
],
[
1535 ,
412
],
[
1535 ,
452
],
[
1272 ,
452
]
]
},
{
\"text\" : \"JAN 13, 2012\" ,
\"confidence\" : 0.9253808856010437 ,
\"text_box_position\" : [
[
1783 ,
412
],
[
2044 ,
412
],
[
2044 ,
455
],
[
1783 ,
455
]
]
},
{
\"text\" : \"TOTAL AMOUNT DUE:\" ,
\"confidence\" : 0.932969331741333 ,
\"text_box_position\" : [
[
1268 ,
483
],
[
1661 ,
480
],
[
1661 ,
524
],
[
1269 ,
527
]
]
},
{
\"text\" : \"$131.12\" ,
\"confidence\" : 0.8625337481498718 ,
\"text_box_position\" : [
[
1780 ,
480
],
[
1940 ,
480
],
[
1940 ,
524
],
[
1780 ,
524
]
]
},
{
\"text\" : \"CUSTOMER\" ,
\"confidence\" : 0.8267655968666077 ,
\"text_box_position\" : [
[
267 ,
499
],
[
744 ,
499
],
[
744 ,
542
],
[
267 ,
542
]
]
},
{
\"text\" : \"DUE DATE:\" ,
\"confidence\" : 0.8796911835670471 ,
\"text_box_position\" : [
[
1272 ,
561
],
[
1466 ,
561
],
[
1466 ,
595
],
[
1272 ,
595
]
]
},
{
\"text\" : \"JAN 30, 2012\" ,
\"confidence\" : 0.92954021692276 ,
\"text_box_position\" : [
[
1783 ,
558
],
[
2044 ,
558
],
[
2044 ,
599
],
[
1783 ,
599
]
]
},
{
\"text\" : \"Client Name\" ,
\"confidence\" : 0.8896594643592834 ,
\"text_box_position\" : [
[
264 ,
602
],
[
512 ,
602
],
[
512 ,
645
],
[
264 ,
645
]
]
},
{
\"text\" : \"PAYMENT ENCLOSED\" ,
\"confidence\" : 0.950208306312561 ,
\"text_box_position\" : [
[
1269 ,
633
],
[
1661 ,
633
],
[
1661 ,
673
],
[
1269 ,
673
]
]
},
{
\"text\" : \"456 Streetname St.\" ,
\"confidence\" : 0.9406694769859314 ,
\"text_box_position\" : [
[
264 ,
648
],
[
644 ,
648
],
[
644 ,
692
],
[
264 ,
692
]
]
},
{
\"text\" : \"Hometown, Statename\" ,
\"confidence\" : 0.928443193435669 ,
\"text_box_position\" : [
[
261 ,
701
],
[
719 ,
701
],
[
719 ,
742
],
[
261 ,
742
]
]
},
{
\"text\" : \"Please return this portion with your payment\" ,
\"confidence\" : 0.9237391948699951 ,
\"text_box_position\" : [
[
1272 ,
730
],
[
2141 ,
730
],
[
2141 ,
773
],
[
1272 ,
773
]
]
},
{
\"text\" : \"ZIPCODE\" ,
\"confidence\" : 0.9558421969413757 ,
\"text_box_position\" : [
[
264 ,
748
],
[
465 ,
748
],
[
465 ,
792
],
[
264 ,
792
]
]
},
{
\"text\" : \"BILLNG SUMMARY: OOO123\" ,
\"confidence\" : 0.8343039155006409 ,
\"text_box_position\" : [
[
267 ,
892
],
[
1394 ,
892
],
[
1394 ,
935
],
[
267 ,
935
]
]
},
{
\"text\" : \"Previous Balance:\" ,
\"confidence\" : 0.8685573935508728 ,
\"text_box_position\" : [
[
261 ,
982
],
[
644 ,
985
],
[
643 ,
1038
],
[
260 ,
1035
]
]
},
{
\"text\" : \"$ 130.22\" ,
\"confidence\" : 0.976387619972229 ,
\"text_box_position\" : [
[
1002 ,
988
],
[
1203 ,
988
],
[
1203 ,
1041
],
[
1002 ,
1041
]
]
},
{
\"text\" : \"Billing Date:\" ,
\"confidence\" : 0.9069855213165283 ,
\"text_box_position\" : [
[
1272 ,
991
],
[
1510 ,
991
],
[
1510 ,
1035
],
[
1272 ,
1035
]
]
},
{
\"text\" : \"JAN 17, 2012\" ,
\"confidence\" : 0.9576613903045654 ,
\"text_box_position\" : [
[
1758 ,
985
],
[
2044 ,
985
],
[
2044 ,
1038
],
[
1758 ,
1038
]
]
},
{
\"text\" : \"$ -130.22\" ,
\"confidence\" : 0.9224404096603394 ,
\"text_box_position\" : [
[
1002 ,
1035
],
[
1206 ,
1035
],
[
1206 ,
1088
],
[
1002 ,
1088
]
]
},
{
\"text\" : \"Total Payment since last bill:\" ,
\"confidence\" : 0.8947998285293579 ,
\"text_box_position\" : [
[
273 ,
1041
],
[
826 ,
1041
],
[
826 ,
1085
],
[
273 ,
1085
]
]
},
{
\"text\" : \"Customer Name:\" ,
\"confidence\" : 0.9364148378372192 ,
\"text_box_position\" : [
[
1272 ,
1041
],
[
1608 ,
1041
],
[
1608 ,
1085
],
[
1272 ,
1085
]
]
},
{
\"text\" : \"NAME SURNAME\" ,
\"confidence\" : 0.9757586121559143 ,
\"text_box_position\" : [
[
1758 ,
1035
],
[
2129 ,
1035
],
[
2129 ,
1079
],
[
1758 ,
1079
]
]
},
{
\"text\" : \"Balance forward:\" ,
\"confidence\" : 0.9202741980552673 ,
\"text_box_position\" : [
[
264 ,
1088
],
[
603 ,
1088
],
[
603 ,
1129
],
[
264 ,
1129
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.9918156266212463 ,
\"text_box_position\" : [
[
1004 ,
1090
],
[
1033 ,
1088
],
[
1037 ,
1130
],
[
1008 ,
1133
]
]
},
{
\"text\" : \"0.00\" ,
\"confidence\" : 0.9836299419403076 ,
\"text_box_position\" : [
[
1102 ,
1091
],
[
1199 ,
1091
],
[
1199 ,
1135
],
[
1102 ,
1135
]
]
},
{
\"text\" : \"Customer Number:\" ,
\"confidence\" : 0.9570369720458984 ,
\"text_box_position\" : [
[
1272 ,
1091
],
[
1648 ,
1091
],
[
1648 ,
1132
],
[
1272 ,
1132
]
]
},
{
\"text\" : \"000123\" ,
\"confidence\" : 0.8004105687141418 ,
\"text_box_position\" : [
[
1758 ,
1088
],
[
1919 ,
1088
],
[
1919 ,
1138
],
[
1758 ,
1138
]
]
},
{
\"text\" : \"Total Current Cable Charges:\" ,
\"confidence\" : 0.9315674901008606 ,
\"text_box_position\" : [
[
267 ,
1138
],
[
845 ,
1141
],
[
844 ,
1185
],
[
267 ,
1182
]
]
},
{
\"text\" : \"$ 159.68\" ,
\"confidence\" : 0.9579035043716431 ,
\"text_box_position\" : [
[
1005 ,
1141
],
[
1196 ,
1141
],
[
1196 ,
1185
],
[
1005 ,
1185
]
]
},
{
\"text\" : \"Mailing Zip Code:\" ,
\"confidence\" : 0.9239545464515686 ,
\"text_box_position\" : [
[
1269 ,
1141
],
[
1620 ,
1141
],
[
1620 ,
1185
],
[
1269 ,
1185
]
]
},
{
\"text\" : \"ZIPCODE\" ,
\"confidence\" : 0.8123308420181274 ,
\"text_box_position\" : [
[
1755 ,
1135
],
[
1959 ,
1135
],
[
1959 ,
1178
],
[
1755 ,
1178
]
]
},
{
\"text\" : \"ACC-32354-078\" ,
\"confidence\" : 0.7928316593170166 ,
\"text_box_position\" : [
[
267 ,
1291
],
[
964 ,
1291
],
[
964 ,
1334
],
[
267 ,
1334
]
]
},
{
\"text\" : \"CABLETV SERVICE\" ,
\"confidence\" : 0.9318665266036987 ,
\"text_box_position\" : [
[
1278 ,
1288
],
[
2038 ,
1291
],
[
2038 ,
1338
],
[
1278 ,
1334
]
]
},
{
\"text\" : \"PERIOD: NOV 26, 2012 - DEC 23, 2012\" ,
\"confidence\" : 0.943903923034668 ,
\"text_box_position\" : [
[
264 ,
1403
],
[
998 ,
1400
],
[
999 ,
1443
],
[
264 ,
1447
]
]
},
{
\"text\" : \"PACKAGE CONTENTS\" ,
\"confidence\" : 0.9540631771087646 ,
\"text_box_position\" : [
[
1278 ,
1406
],
[
1718 ,
1406
],
[
1718 ,
1447
],
[
1278 ,
1447
]
]
},
{
\"text\" : \"TV Package:\" ,
\"confidence\" : 0.9122953414916992 ,
\"text_box_position\" : [
[
265 ,
1459
],
[
506 ,
1466
],
[
505 ,
1509
],
[
263 ,
1502
]
]
},
{
\"text\" : \"BASIC CHANNELS PACKAGE\" ,
\"confidence\" : 0.965810239315033 ,
\"text_box_position\" : [
[
1325 ,
1506
],
[
1689 ,
1506
],
[
1689 ,
1537
],
[
1325 ,
1537
]
]
},
{
\"text\" : \"47.30\" ,
\"confidence\" : 0.9827944040298462 ,
\"text_box_position\" : [
[
1093 ,
1509
],
[
1199 ,
1509
],
[
1199 ,
1553
],
[
1093 ,
1553
]
]
},
{
\"text\" : \"Receiver Fee:\" ,
\"confidence\" : 0.9497257471084595 ,
\"text_box_position\" : [
[
267 ,
1512
],
[
524 ,
1512
],
[
524 ,
1553
],
[
267 ,
1553
]
]
},
{
\"text\" : \"15\" ,
\"confidence\" : 0.9130323529243469 ,
\"text_box_position\" : [
[
1790 ,
1506
],
[
1821 ,
1506
],
[
1821 ,
1537
],
[
1790 ,
1537
]
]
},
{
\"text\" : \"LOCAL CHANNELS PACKAGE\" ,
\"confidence\" : 0.9152548313140869 ,
\"text_box_position\" : [
[
1325 ,
1543
],
[
1702 ,
1543
],
[
1702 ,
1574
],
[
1325 ,
1574
]
]
},
{
\"text\" : \"$$\" ,
\"confidence\" : 0.8538428544998169 ,
\"text_box_position\" : [
[
1002 ,
1546
],
[
1040 ,
1548
],
[
1032 ,
1653
],
[
995 ,
1650
]
]
},
{
\"text\" : \"5\" ,
\"confidence\" : 0.8671046495437622 ,
\"text_box_position\" : [
[
1799 ,
1540
],
[
1821 ,
1540
],
[
1821 ,
1578
],
[
1799 ,
1578
]
]
},
{
\"text\" : \"Local Video Facilities Fee:\" ,
\"confidence\" : 0.9475012421607971 ,
\"text_box_position\" : [
[
267 ,
1556
],
[
744 ,
1556
],
[
744 ,
1596
],
[
267 ,
1596
]
]
},
{
\"text\" : \"30.61\" ,
\"confidence\" : 0.9413079023361206 ,
\"text_box_position\" : [
[
1090 ,
1553
],
[
1199 ,
1553
],
[
1199 ,
1599
],
[
1090 ,
1599
]
]
},
{
\"text\" : \"SPECIALTY PACKAGE\" ,
\"confidence\" : 0.9340656995773315 ,
\"text_box_position\" : [
[
1325 ,
1584
],
[
1605 ,
1584
],
[
1605 ,
1615
],
[
1325 ,
1615
]
]
},
{
\"text\" : \"25\" ,
\"confidence\" : 0.9997925758361816 ,
\"text_box_position\" : [
[
1780 ,
1581
],
[
1821 ,
1581
],
[
1821 ,
1621
],
[
1780 ,
1621
]
]
},
{
\"text\" : \"Local Video Service Fee:\" ,
\"confidence\" : 0.9613704085350037 ,
\"text_box_position\" : [
[
267 ,
1603
],
[
722 ,
1603
],
[
722 ,
1643
],
[
267 ,
1643
]
]
},
{
\"text\" : \"4.58\" ,
\"confidence\" : 0.9998648762702942 ,
\"text_box_position\" : [
[
1107 ,
1601
],
[
1199 ,
1592
],
[
1204 ,
1642
],
[
1112 ,
1650
]
]
},
{
\"text\" : \"MOVIES CHANNELS PACKAGE\" ,
\"confidence\" : 0.9223537445068359 ,
\"text_box_position\" : [
[
1322 ,
1624
],
[
1711 ,
1618
],
[
1711 ,
1649
],
[
1322 ,
1656
]
]
},
{
\"text\" : \"10\" ,
\"confidence\" : 0.9752267003059387 ,
\"text_box_position\" : [
[
1783 ,
1618
],
[
1821 ,
1618
],
[
1821 ,
1662
],
[
1783 ,
1662
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.5696873068809509 ,
\"text_box_position\" : [
[
1008 ,
1646
],
[
1033 ,
1646
],
[
1033 ,
1696
],
[
1008 ,
1696
]
]
},
{
\"text\" : \"Cable Maintenance Fee:\" ,
\"confidence\" : 0.9219371676445007 ,
\"text_box_position\" : [
[
267 ,
1649
],
[
713 ,
1649
],
[
713 ,
1690
],
[
267 ,
1690
]
]
},
{
\"text\" : \"4.48\" ,
\"confidence\" : 0.9998817443847656 ,
\"text_box_position\" : [
[
1112 ,
1643
],
[
1203 ,
1643
],
[
1203 ,
1690
],
[
1112 ,
1690
]
]
},
{
\"text\" : \"NEWS CHANNELS PACKAGE\" ,
\"confidence\" : 0.9252066016197205 ,
\"text_box_position\" : [
[
1328 ,
1659
],
[
1689 ,
1659
],
[
1689 ,
1690
],
[
1328 ,
1690
]
]
},
{
\"text\" : \"15\" ,
\"confidence\" : 0.9995821118354797 ,
\"text_box_position\" : [
[
1790 ,
1662
],
[
1818 ,
1662
],
[
1818 ,
1696
],
[
1790 ,
1696
]
]
},
{
\"text\" : \"Taxes:\" ,
\"confidence\" : 0.9865601658821106 ,
\"text_box_position\" : [
[
267 ,
1693
],
[
386 ,
1693
],
[
386 ,
1737
],
[
267 ,
1737
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.5572978854179382 ,
\"text_box_position\" : [
[
1008 ,
1693
],
[
1033 ,
1693
],
[
1033 ,
1740
],
[
1008 ,
1740
]
]
},
{
\"text\" : \"11.31\" ,
\"confidence\" : 0.8934833407402039 ,
\"text_box_position\" : [
[
1093 ,
1690
],
[
1199 ,
1690
],
[
1199 ,
1737
],
[
1093 ,
1737
]
]
},
{
\"text\" : \"SPORTS CHANNELS PACKAGE\" ,
\"confidence\" : 0.9512339234352112 ,
\"text_box_position\" : [
[
1319 ,
1696
],
[
1714 ,
1693
],
[
1715 ,
1733
],
[
1319 ,
1737
]
]
},
{
\"text\" : \"11\" ,
\"confidence\" : 0.9993605613708496 ,
\"text_box_position\" : [
[
1790 ,
1702
],
[
1821 ,
1702
],
[
1821 ,
1733
],
[
1790 ,
1733
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.5105180144309998 ,
\"text_box_position\" : [
[
1008 ,
1737
],
[
1033 ,
1737
],
[
1033 ,
1786
],
[
1008 ,
1786
]
]
},
{
\"text\" : \"Transit Sales tax:\" ,
\"confidence\" : 0.8876104950904846 ,
\"text_box_position\" : [
[
267 ,
1740
],
[
584 ,
1740
],
[
584 ,
1780
],
[
267 ,
1780
]
]
},
{
\"text\" : \"98.28\" ,
\"confidence\" : 0.8715541958808899 ,
\"text_box_position\" : [
[
1090 ,
1733
],
[
1199 ,
1733
],
[
1199 ,
1780
],
[
1090 ,
1780
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.8651805520057678 ,
\"text_box_position\" : [
[
1008 ,
1783
],
[
1033 ,
1783
],
[
1033 ,
1833
],
[
1008 ,
1833
]
]
},
{
\"text\" : \"Local benefit:\" ,
\"confidence\" : 0.9869930148124695 ,
\"text_box_position\" : [
[
260 ,
1784
],
[
511 ,
1780
],
[
512 ,
1824
],
[
261 ,
1827
]
]
},
{
\"text\" : \"-9.82\" ,
\"confidence\" : 0.9988659024238586 ,
\"text_box_position\" : [
[
1095 ,
1781
],
[
1197 ,
1773
],
[
1201 ,
1820
],
[
1099 ,
1828
]
]
},
{
\"text\" : \"TOTAL CHANNELS:\" ,
\"confidence\" : 0.9535830616950989 ,
\"text_box_position\" : [
[
1272 ,
1824
],
[
1655 ,
1824
],
[
1655 ,
1864
],
[
1272 ,
1864
]
]
},
{
\"text\" : \"Total Cable TV Service Charges:\" ,
\"confidence\" : 0.9528170228004456 ,
\"text_box_position\" : [
[
264 ,
1827
],
[
892 ,
1830
],
[
892 ,
1874
],
[
264 ,
1871
]
]
},
{
\"text\" : \"88.46\" ,
\"confidence\" : 0.9400895237922668 ,
\"text_box_position\" : [
[
1090 ,
1827
],
[
1203 ,
1827
],
[
1203 ,
1871
],
[
1090 ,
1871
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.9752700924873352 ,
\"text_box_position\" : [
[
1008 ,
1830
],
[
1036 ,
1830
],
[
1036 ,
1871
],
[
1008 ,
1871
]
]
},
{
\"text\" : \"81\" ,
\"confidence\" : 0.9997446537017822 ,
\"text_box_position\" : [
[
1774 ,
1824
],
[
1824 ,
1824
],
[
1824 ,
1864
],
[
1774 ,
1864
]
]
},
{
\"text\" : \"ACC. 32354-078\" ,
\"confidence\" : 0.8781741261482239 ,
\"text_box_position\" : [
[
257 ,
1970
],
[
967 ,
1967
],
[
967 ,
2020
],
[
258 ,
2023
]
]
},
{
\"text\" : \"PHONESERVCE\" ,
\"confidence\" : 0.9341196417808533 ,
\"text_box_position\" : [
[
1281 ,
1977
],
[
1934 ,
1977
],
[
1934 ,
2020
],
[
1281 ,
2020
]
]
},
{
\"text\" : \"PERIOD: NOV 26, 2012 - DEC 23, 2012\" ,
\"confidence\" : 0.8919095396995544 ,
\"text_box_position\" : [
[
264 ,
2083
],
[
999 ,
2086
],
[
998 ,
2129
],
[
264 ,
2126
]
]
},
{
\"text\" : \"CUSTOMER REFERENCE NUMBER:\" ,
\"confidence\" : 0.9368194341659546 ,
\"text_box_position\" : [
[
1281 ,
2086
],
[
1978 ,
2086
],
[
1978 ,
2126
],
[
1281 ,
2126
]
]
},
{
\"text\" : \"789123\" ,
\"confidence\" : 0.9293386936187744 ,
\"text_box_position\" : [
[
2028 ,
2086
],
[
2170 ,
2086
],
[
2170 ,
2129
],
[
2028 ,
2129
]
]
},
{
\"text\" : \"Land Line Service:\" ,
\"confidence\" : 0.9711768627166748 ,
\"text_box_position\" : [
[
264 ,
2173
],
[
631 ,
2176
],
[
631 ,
2220
],
[
264 ,
2217
]
]
},
{
\"text\" : \"READ DATE\" ,
\"confidence\" : 0.8778533935546875 ,
\"text_box_position\" : [
[
1272 ,
2176
],
[
1410 ,
2176
],
[
1410 ,
2207
],
[
1272 ,
2207
]
]
},
{
\"text\" : \"TIMEUSED/CHARGES\" ,
\"confidence\" : 0.8961445093154907 ,
\"text_box_position\" : [
[
1397 ,
2176
],
[
1674 ,
2176
],
[
1674 ,
2207
],
[
1397 ,
2207
]
]
},
{
\"text\" : \"MINUTES / $\" ,
\"confidence\" : 0.9205219149589539 ,
\"text_box_position\" : [
[
2032 ,
2176
],
[
2173 ,
2176
],
[
2173 ,
2207
],
[
2032 ,
2207
]
]
},
{
\"text\" : \"Domestic Charges:\" ,
\"confidence\" : 0.9528235197067261 ,
\"text_box_position\" : [
[
264 ,
2220
],
[
641 ,
2223
],
[
640 ,
2267
],
[
264 ,
2263
]
]
},
{
\"text\" : \"14.95\" ,
\"confidence\" : 0.8792974352836609 ,
\"text_box_position\" : [
[
1090 ,
2220
],
[
1203 ,
2220
],
[
1203 ,
2267
],
[
1090 ,
2267
]
]
},
{
\"text\" : \"DEC-23-12\" ,
\"confidence\" : 0.9403826594352722 ,
\"text_box_position\" : [
[
1272 ,
2214
],
[
1404 ,
2214
],
[
1404 ,
2245
],
[
1272 ,
2245
]
]
},
{
\"text\" : \"NOV-25-12\" ,
\"confidence\" : 0.9199998378753662 ,
\"text_box_position\" : [
[
1272 ,
2242
],
[
1404 ,
2242
],
[
1404 ,
2273
],
[
1272 ,
2273
]
]
},
{
\"text\" : \"Minutes Used:\" ,
\"confidence\" : 0.9614792466163635 ,
\"text_box_position\" : [
[
295 ,
2267
],
[
562 ,
2263
],
[
562 ,
2307
],
[
296 ,
2310
]
]
},
{
\"text\" : \"211\" ,
\"confidence\" : 0.9515474438667297 ,
\"text_box_position\" : [
[
1124 ,
2263
],
[
1199 ,
2263
],
[
1199 ,
2313
],
[
1124 ,
2313
]
]
},
{
\"text\" : \"OCT-23-12\" ,
\"confidence\" : 0.9917921423912048 ,
\"text_box_position\" : [
[
1272 ,
2270
],
[
1407 ,
2270
],
[
1407 ,
2301
],
[
1272 ,
2301
]
]
},
{
\"text\" : \"SEP-24-12\" ,
\"confidence\" : 0.9436533451080322 ,
\"text_box_position\" : [
[
1272 ,
2298
],
[
1400 ,
2298
],
[
1400 ,
2332
],
[
1272 ,
2332
]
]
},
{
\"text\" : \"Number Of Calls:\" ,
\"confidence\" : 0.9414534568786621 ,
\"text_box_position\" : [
[
295 ,
2313
],
[
619 ,
2313
],
[
619 ,
2357
],
[
295 ,
2357
]
]
},
{
\"text\" : \"38\" ,
\"confidence\" : 0.9998018741607666 ,
\"text_box_position\" : [
[
1137 ,
2315
],
[
1200 ,
2305
],
[
1209 ,
2355
],
[
1145 ,
2365
]
]
},
{
\"text\" : \"AUG-26-12\" ,
\"confidence\" : 0.8633952736854553 ,
\"text_box_position\" : [
[
1272 ,
2329
],
[
1407 ,
2329
],
[
1407 ,
2360
],
[
1272 ,
2360
]
]
},
{
\"text\" : \"JUL-27-12\" ,
\"confidence\" : 0.916667103767395 ,
\"text_box_position\" : [
[
1269 ,
2357
],
[
1400 ,
2357
],
[
1400 ,
2388
],
[
1269 ,
2388
]
]
},
{
\"text\" : \"JUN-23-12\" ,
\"confidence\" : 0.9974968433380127 ,
\"text_box_position\" : [
[
1269 ,
2382
],
[
1404 ,
2382
],
[
1404 ,
2426
],
[
1269 ,
2426
]
]
},
{
\"text\" : \"Long Distance Charges:\" ,
\"confidence\" : 0.9401722550392151 ,
\"text_box_position\" : [
[
264 ,
2404
],
[
738 ,
2404
],
[
738 ,
2447
],
[
264 ,
2447
]
]
},
{
\"text\" : \"ss\" ,
\"confidence\" : 0.5249807238578796 ,
\"text_box_position\" : [
[
999 ,
2401
],
[
1042 ,
2401
],
[
1042 ,
2504
],
[
999 ,
2504
]
]
},
{
\"text\" : \"24.48\" ,
\"confidence\" : 0.9268577694892883 ,
\"text_box_position\" : [
[
1086 ,
2404
],
[
1199 ,
2404
],
[
1199 ,
2447
],
[
1086 ,
2447
]
]
},
{
\"text\" : \"MAY-23-12\" ,
\"confidence\" : 0.9517567753791809 ,
\"text_box_position\" : [
[
1272 ,
2416
],
[
1400 ,
2416
],
[
1400 ,
2447
],
[
1272 ,
2447
]
]
},
{
\"text\" : \"APR-25-12\" ,
\"confidence\" : 0.9582078456878662 ,
\"text_box_position\" : [
[
1272 ,
2441
],
[
1400 ,
2441
],
[
1400 ,
2475
],
[
1272 ,
2475
]
]
},
{
\"text\" : \"Minutes Used:\" ,
\"confidence\" : 0.967995285987854 ,
\"text_box_position\" : [
[
298 ,
2451
],
[
562 ,
2451
],
[
562 ,
2491
],
[
298 ,
2491
]
]
},
{
\"text\" : \"48\" ,
\"confidence\" : 0.9999104142189026 ,
\"text_box_position\" : [
[
1146 ,
2451
],
[
1199 ,
2451
],
[
1199 ,
2494
],
[
1146 ,
2494
]
]
},
{
\"text\" : \"MAR-24-12\" ,
\"confidence\" : 0.9600687026977539 ,
\"text_box_position\" : [
[
1272 ,
2472
],
[
1404 ,
2472
],
[
1404 ,
2507
],
[
1272 ,
2507
]
]
},
{
\"text\" : \"Number Of Calls:\" ,
\"confidence\" : 0.9709181785583496 ,
\"text_box_position\" : [
[
298 ,
2497
],
[
619 ,
2497
],
[
619 ,
2538
],
[
298 ,
2538
]
]
},
{
\"text\" : \"12\" ,
\"confidence\" : 0.9997631907463074 ,
\"text_box_position\" : [
[
1152 ,
2494
],
[
1199 ,
2494
],
[
1199 ,
2541
],
[
1152 ,
2541
]
]
},
{
\"text\" : \"FEB-21-12\" ,
\"confidence\" : 0.9404104948043823 ,
\"text_box_position\" : [
[
1272 ,
2504
],
[
1400 ,
2504
],
[
1400 ,
2535
],
[
1272 ,
2535
]
]
},
{
\"text\" : \"JAN-27-12\" ,
\"confidence\" : 0.9969313144683838 ,
\"text_box_position\" : [
[
1272 ,
2528
],
[
1400 ,
2528
],
[
1400 ,
2563
],
[
1272 ,
2563
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.9688901305198669 ,
\"text_box_position\" : [
[
1002 ,
2541
],
[
1039 ,
2541
],
[
1039 ,
2594
],
[
1002 ,
2594
]
]
},
{
\"text\" : \"Taxes:\" ,
\"confidence\" : 0.8903786540031433 ,
\"text_box_position\" : [
[
266 ,
2545
],
[
381 ,
2537
],
[
384 ,
2578
],
[
269 ,
2585
]
]
},
{
\"text\" : \"9.65\" ,
\"confidence\" : 0.9998161792755127 ,
\"text_box_position\" : [
[
1112 ,
2538
],
[
1203 ,
2538
],
[
1203 ,
2585
],
[
1112 ,
2585
]
]
},
{
\"text\" : \"DEC-20-12\" ,
\"confidence\" : 0.9199405312538147 ,
\"text_box_position\" : [
[
1272 ,
2560
],
[
1400 ,
2560
],
[
1400 ,
2594
],
[
1272 ,
2594
]
]
},
{
\"text\" : \"Total Phone Service Charges:\" ,
\"confidence\" : 0.9219585657119751 ,
\"text_box_position\" : [
[
267 ,
2588
],
[
845 ,
2588
],
[
845 ,
2628
],
[
267 ,
2628
]
]
},
{
\"text\" : \"$\" ,
\"confidence\" : 0.9904311299324036 ,
\"text_box_position\" : [
[
1008 ,
2588
],
[
1039 ,
2588
],
[
1039 ,
2634
],
[
1008 ,
2634
]
]
},
{
\"text\" : \"42.66\" ,
\"confidence\" : 0.994714081287384 ,
\"text_box_position\" : [
[
1085 ,
2586
],
[
1200 ,
2577
],
[
1204 ,
2624
],
[
1089 ,
2632
]
]
},
{
\"text\" : \"TOTAL CHARGES:\" ,
\"confidence\" : 0.8560213446617126 ,
\"text_box_position\" : [
[
258 ,
2734
],
[
964 ,
2737
],
[
964 ,
2790
],
[
257 ,
2787
]
]
},
{
\"text\" : \"$ 131.12\" ,
\"confidence\" : 0.912606418132782 ,
\"text_box_position\" : [
[
1809 ,
2737
],
[
2126 ,
2737
],
[
2126 ,
2790
],
[
1809 ,
2790
]
]
}
]
}
]
}"""
input_json = gr.inputs.Textbox(label="Enter OCR JSON (or click example)", default=default_example)
def submit_json(json_data):
result = process_json(json_data)
return result
gr.Interface(
fn=submit_json,
inputs=[input_json],
outputs="text",
examples=examples,
title="Snail Mail Muncher",
description="""Enter JSON data from PP OCR v3 and click Submit to process it.
Note that an enhanced workflow would start with an image file, send it to a hosted PP-OCR inference API, process it to get this JSON, and submit for you. This is a simple example that let's you copy/paste json from your own document OR you may also use the example, which comes from the 'SampleCableBill.png' in the related repo. In this example we use OpenAI but with an updated prompt something open source like Dolly would be more ideal.""",
theme="default",
).launch()
launch_demo()