Update app.py
Browse files
app.py
CHANGED
@@ -51,7 +51,7 @@ def fx_dd(tk:str,s:str):
|
|
51 |
response=requests.post(url,json=data,headers=headers)
|
52 |
return response.text
|
53 |
|
54 |
-
def dd_ocr(tk
|
55 |
headers= {"Content-Type": "application/json"}
|
56 |
url="https://oapi.dingtalk.com/topapi/ocr/structured/recognize?access_token="+tk
|
57 |
dc={"身份证":"idcard","增值税发票":"invoice","营业执照":"blicense","银行卡":"bank_card","车牌":"car_no","机动车发票":"car_invoice","驾驶证":"driving_license","行驶证":"vehicle_license","火车票":"train_ticket","定额发票":"quota_invoice","出租车发票":"taxi_ticket","机票行程单":"air_itinerary","审批表单":"approval_table","花名册":"roster"}
|
@@ -105,7 +105,7 @@ with demo:
|
|
105 |
|
106 |
with gr.TabItem("钉钉ocr"):
|
107 |
gr.Markdown("# 网络图片OCR识别")
|
108 |
-
ocr_input=[gr.Textbox(label="请填写ocr_token"),gr.Textbox(label="请填写图片网址"),gr.Radio(["身份证","增值税发票","营业执照","银行卡","车牌","机动车发票","驾驶证","行驶证","火车票","定额发票","出租车发票","机票行程单","审批表单","花名册"],"营业执照增值税发票",label="请选择识别类型:")]
|
109 |
ocr_button=gr.Button("开始识别>>")
|
110 |
ocr_output=gr.JSON(label="识别结果")
|
111 |
ocr_button.click(dd_ocr, inputs=ocr_input, outputs=ocr_output,api_name='dingding_ocr')
|
|
|
51 |
response=requests.post(url,json=data,headers=headers)
|
52 |
return response.text
|
53 |
|
54 |
+
def dd_ocr(tk,sl,dt):
|
55 |
headers= {"Content-Type": "application/json"}
|
56 |
url="https://oapi.dingtalk.com/topapi/ocr/structured/recognize?access_token="+tk
|
57 |
dc={"身份证":"idcard","增值税发票":"invoice","营业执照":"blicense","银行卡":"bank_card","车牌":"car_no","机动车发票":"car_invoice","驾驶证":"driving_license","行驶证":"vehicle_license","火车票":"train_ticket","定额发票":"quota_invoice","出租车发票":"taxi_ticket","机票行程单":"air_itinerary","审批表单":"approval_table","花名册":"roster"}
|
|
|
105 |
|
106 |
with gr.TabItem("钉钉ocr"):
|
107 |
gr.Markdown("# 网络图片OCR识别")
|
108 |
+
ocr_input=[gr.Textbox(label="请填写ocr_token"),gr.Textbox(label="请填写图片网址"),gr.Radio(["身份证","增值税发票","营业执照","银行卡","车牌","机动车发票","驾驶证","行驶证","火车票","定额发票","出租车发票","机票行程单","审批表单","花名册"],value="营业执照增值税发票",label="请选择识别类型:")]
|
109 |
ocr_button=gr.Button("开始识别>>")
|
110 |
ocr_output=gr.JSON(label="识别结果")
|
111 |
ocr_button.click(dd_ocr, inputs=ocr_input, outputs=ocr_output,api_name='dingding_ocr')
|