File size: 1,480 Bytes
b966bc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from meutils.pipe import *

from appzoo.streamlit_app import Page

import streamlit as st

from aip import AipOcr

APP_ID, API_KEY, SECRET_KEY = "25308860,GmAPqlyBDNLaoAqO2mrFhjS2,vXIoxFUdx2jiuRnGLvZSDMEczEaZsc1K".split(',')

client = AipOcr(APP_ID, API_KEY, SECRET_KEY)

""" 读取图片 """


def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()


""" 如果有可选参数 """
options = {}
options["language_type"] = "CHN_ENG"
options["detect_direction"] = "true"
options["detect_language"] = "true"
options["probability"] = "true"


class MyPage(Page):

    def main(self):
        with st.form("Coding"):
            file = st.file_uploader("请上传不动产证明😄", "")

            if st.form_submit_button('开始认证'):
                if file:
                    r = client.basicGeneral(file.read())
                    r = '\n'.join(list(map(lambda d: d.get('words'), r['words_result'][4:11])))
                    st.text(r)

                else:
                    st.markdown("# 请上传不动产证明😄再点认证👆🏻")
                    _ = '2022年11月16日,根据查询人\n张三李四\n申请,经查询,结果如下:\n编号:\n202211160344242218\n坐落\n雨花台区西善桥街道云上润府观庭 - 6幢6单元2206室'
                    st.text(_)


if __name__ == '__main__':
    app_title = "# 认证"
    app_info = ""
    MyPage(app_title=app_title, app_info=app_info).main()