当前位置:网站首页>30 lines of code to realize serverless real-time health code recognition -- operation manual
30 lines of code to realize serverless real-time health code recognition -- operation manual
2022-08-02 12:19:00 【HUAWEI CLOUD】
1 实验介绍
• 实验描述:In this experiment, the text recognition service will be usedSDK开发包,Try the text recognition service,and based on thisBuild yousmart applications and systems.无需配置和管理服务器等基础设施,函数以弹性、免运维、高可靠的方式运行.
• 内容介绍:On HUAWEI CLOUD Function Workflow Service,按照指导创建函数,通过OBS桶上Pass the health code截图,The trigger function passes华为云OCR SDK调用通用文字识别服务,识别Health code content.
2 前提条件
This experiment needs to be performed on HUAWEI CLOUD,Therefore, users need to log in with a HUAWEI CLOUD account;
If you don't have a HUAWEI CLOUD account, please do so firstRegister a HUAWEI CLOUD account and complete real-name authentication,Please use it during the experimentChrome浏览器完成相关操作.
Please refer to HUAWEI CLOUD account registration steps:
https://support.huaweicloud.com/intl/zh-cn/usermanual-account/account_id_001.html
Please refer to the real-name authentication operation steps:
https://support.huaweicloud.com/intl/zh-cn/usermanual-account/zh-cn_topic_0119621533.html
3 操作指导
3.1 登录华为云
Users who already have an account or have completed registration log in to Huawei云官网:【https://www.huaweicloud.com/】
Please refer to HUAWEI CLOUD login:
https://support.huaweicloud.com/usermanual-iam/iam_01_0033.html
3.2 获取ak/sk
AK/SK(Access Key ID/Secret Access Key)即访问密钥,Contains the access keyID(AK)和秘密访问密钥(SK)两部分,华为云通过AK识别用户的身份,通过SK对请求数据进行签名验证,用于确保请求的机密性、完整性和请求者身份的正确性.
操作步骤
a) 登录HUAWEI CLOUD management console,Point your mouse to the username in the upper right corner of the page,在下拉列表中单击“我的凭证”.
b) 在“我的凭证”页面中选择“访问密钥”页签.单击“Added access secret钥”,Follow the instructions to obtain an authentication accountAK/SK,请妥善保管AK/SK信息.
3.3 开通OCR文字识别服务
The mouse points to the upper left corner of the page“服务列表”,Find it after expansion“人工智能”下的“文字识别”点击打开.
In the upper left corner of the page will beThe area switches to“北京四”,找到“通用文字识别”点击“开通服务”.
3.4 Get the health code identification code
浏览器打开:https://health-qr-recognition-code.obs.cn-north-4.myhuaweicloud.com/Health-QR-Recognition.txt,下载文件,保存本地,以备后续步骤使用.
3.5 Configure health code recognition函数
3.5.1 创建函数
The mouse points to the upper left corner of the page“服务列表”,Find it after expansion“算”下的“函数工作流(functionGraph)”点击打开.
Navigate on the left栏展开“函数”菜单,点击选择“函数列表”,Then click the upper right corner of the function list page“创建函数”按钮.
在“Create a function page”Custom input function name(我这里用的是Health-QR-Recognition),其他配置默认,点击“Create a function button”.
3.5.2 修改代码
页面跳转到 函数详情页面,将index.jsThe code inside the file is removed,用3.4Steps get code replacement,点击“部署”按钮进行保存.
3.5.3 添加依赖包
向下滚动页面,点击“添加依赖包”按钮.
按“ocr”搜索依赖包,选择“cloud-ocr-sdk-nodejs-1.0.3”Click after the dependency package“确认”按钮.
3.5.4 Add environment scalars
切换至“设置”页签,选择“环境变量”,点击“Add environment scalars”按钮.
添加键:ocrEndpoint,值:ocr.cn-north-4.myhuaweicloud.com,后点击“保存”按钮.
3.5.5 开通日志服务
切换到“监控”页签,选择“日志”,点击“立即开通”按钮.
3.5.6 创建触发器
还是在“设置”页签,选择点击“触发器”页签,点击“创建触发器”按钮.
on the Create Trigger page,触发器类型选择“对象存储服务(OBS)” 后点击“创建桶”.
跳转到OBSService Create Bucket page,Configure and create as shown belowOBS桶后,点击“立即创建”按钮(If there is a prompt pop-up box,点击“确定”即可),完成OBSbucket creation.
区域:华北-北京四
数据冗余存储策略:单AZ存储
桶名称:自定义(我这里用的是“health-qr-healthsource-img-obs”)
Other content defaults
点击“立即创建”按钮.
待OBS创建完毕,Return to the Function Create Trigger page,点击按钮刷新,
桶:Select the bucket you just created(That is, the bucket with the custom name in the previous step)
事件:选择Put,Post事件
后缀:jpg(上传图片的后缀,Consistent with the suffix of the subsequently recognized picture)
后点击“确定”按钮,完成OBS触发器创建.
3.6 上传图片触发函数执行
回到OBS列表页,Select Open previously createdOBS.
Navigate on the left栏选择“对象”,点击 “上传对象”按钮,Drag and drop the local health code to the red box.
点击“上传”按钮.
3.7 View the function execution log
Enter on the function page“监控”页签,选择“日志”,You can see that the image upload has triggered the function execution(Without logging,You can wait for a while,Log synchronization is slightly delayed),Click to invoke the result as“执行成功”对应的“请求ID”.
Read the log content,可以看到,The uploaded health code content has passedjson格式返回.
4 后续
This experiment was passedOBSBy uploading the health code,The trigger function identifies the content of the health code,Of course, this is the core part of image content recognition,If you want to batch process and store the results,Also need to develop a small program,As the entrance for users to upload health code pictures,The results of image analysis need to be further extracted and stored,And abnormal code timely alarm,Here they are introduced one by one,Let the developers play freely.
边栏推荐
- 技术分享| 融合调度系统中的电子围栏功能说明
- How to set up wireless PPI communication between Weiluntong touch screen and S7-200smart?
- 学习经验分享之七:YOLOv5代码中文注释
- 智能图像分析-智能家用电器图像目标检测统计计数检测与识别-艾科瑞特科技(iCREDIT)
- #夏日挑战赛#【FFH】OpenHarmony设备开发基础(三)编译依赖
- MyCat2的介绍与安装以及基本使用
- 观察者(observer)模式(二) —— 实现线程安全的监听器
- pig4cloud服务架构使用
- Create your own app applet ecosystem with applet containers
- SQL Server如何建表
猜你喜欢
Technology sharing | Description of the electronic fence function in the integrated dispatching system
MD5详解(校验文件完整性)
Process finished with exit code 1
内存存储结构
力扣151-颠倒字符串中的单词
unique in numpy & pandas
Taurus.MVC V3.0.3 Microservice Open Source Framework Released: Make the evolution of .NET architecture easier in large concurrency.
How to connect TDengine through DBeaver?
手撸架构,MongDB 面试50问
力扣209-长度最小的字符串——滑动窗口法
随机推荐
喜迎八一 《社会企业开展应聘文职人员培训规范》团体标准出版发行会暨橄榄枝大课堂上线发布会在北京举行
力扣209-长度最小的字符串——滑动窗口法
DTG-SSOD: The latest semi-supervised detection framework, Dense Teacher (with paper download)
#Summer Challenge#[FFH] OpenHarmony Device Development Foundation (3) Compilation Dependencies
After Effects 教程,如何在 After Effects 中对蒙版进行动画绘制?
MD5 detailed explanation (check file integrity)
JVM学习----垃圾回收调优
测试开发之路,我在大厂做测试这四年的感悟
unique in numpy & pandas
jvmxmx和xms参数分析(设定优化校准)
借小程序容器打造自有App小程序生态
ssm access database data error
AQS-AbstractQueuedSynchronizer
观察者(observer)模式(二) —— 实现线程安全的监听器
Process finished with exit code 1
Pod Scheduling Strategy: Affinity, Stain and Stain Tolerance
Seneor曝光基础知识
Idea 全局搜索(idea如何全局搜索关键字)
Hand rolled architecture, 41 Redis interview asked
WebUI自动化测试框架搭建从0到1(完整源码)更新完毕