当前位置:网站首页>No server is required, teach you to get real-time health code recognition with only 30 lines of code
No server is required, teach you to get real-time health code recognition with only 30 lines of code
2022-08-04 16:02:00 【InfoQ】
This article is shared from HUAWEI CLOUD Community "
Helping epidemic prevention and control, 30 lines of code can handle real-time serverless health code recognition!
", author: HUAWEI CLOUD PaaS service Xiaozhi.
The COVID-19 outbreak has spread far and wide and has lasted longer than we expected.Since the outbreak of the epidemic, almost everyone's life has been affected. Fortunately, it is now the digital era. In order to prevent and control the epidemic, the health code has become our passport, which has minimized the epidemic's restrictions on our travel..
In April, the epidemic in Shanghai was raging, and the development of the epidemic affected the hearts of countless Chinese people. Everyone was doing their best to fight the epidemic. At that time, I saw an article "
Dr. Fudan used 130 lines of code to solve nucleic acid statistics, and completed an hour of manual workload in 2 minutes
” report, which reminds me of myself as a mother,One of the things that must be done every day is to upload the health codes of yourself and your family to the school. From another perspective, during the epidemic, various schools, governments, shopping malls and other institutions need to collect a large number of nucleic acid reports and health codes every day. Manual review is not only time-consuming and time-consuming.It is easy to make mistakes and cannot find problems in time.For solving manual repetitive work, computer programs can be said to bear the brunt. Like this Fudan doctor, it is a good idea to use python code for nucleic acid statistics.
I remembered a HUAWEI CLOUD developer event "Serverless Master Pretenders Crash Course" that used the text recognition OCR mentioned in the report, the difference is that HUAWEI CLOUD is based onIt is provided in the form of cloud services, and the platform-function workflow FunctionGraph used in this activity, does not need to build a local code environment to develop directly on the cloud, deploy on the cloud, and does not require a server, which feels more lightweight and convenient. Thinking of this, II am going to use the content of this study to build an application for health code recognition.


First of all, the main content of the health code is all text, so I opened it firstUniversal text recognition service for HUAWEI CLOUD OCR.

then press activityGuide, create a function in the function workflow FunctionGraph, and reuse the code used in the activity, but change the type of the ocr service called to general text recognition.

That's it?With trepidation, I identified a big data formation card of my own.

So farIt all looks good, but considering that if it is put into actual business scenarios, this seems to be far from enough.If the screenshots are collected and then analyzed and processed centrally, it will definitely take a while, and there is still a problem that the screenshots cannot be analyzed in a timely manner in the centralized processing. For example, the time for submitting an abnormal screenshot and the time for centralized processing are relatively largeIf there is a time difference, it will cause the possibility of further spread of the epidemic.
Function Workflow FunctionGraph supports the creation of triggers, so I created an OBS trigger for the function, so that as long as an image is uploaded to this OBS, it will trigger the execution of the health code recognition function.


Try again, is it OK to upload a screenshot of the health code to the OBS bucketTrigger function execution.


It's done, I counted it, except for the comments, there are only thirty or soThe real-time analysis of the health code can be done with just one line of code, and the sense of achievement is full. For those who want to try it, I have carefully prepared "
30 lines of code to realize serverless real-time health code recognition.--Operation Manual
", use it quickly!!!
Of course, to put it into use, other capabilities are needed, such as health code submission entry, abnormal code alarm, data storage, etc. These are left to developers to play freely!
Click to follow and learn about HUAWEI CLOUD's new technologies for the first time~
边栏推荐
猜你喜欢

【伸手党福利】投影仪初学者入门——投影亮度及幕布选择——从入门到精通

西安纵横资讯×JNPF:适配中国企业特色,全面集成费用管控体系

跟我学 UML 系统建模

Semaphore 基本原理

字节API鉴权方法

直播回放含 PPT 下载|基于 Flink & DeepRec 构建 Online Deep Learning

【已解决】allure无法生成json文件和AttributeError: module ‘allure‘ has no attribute ‘severity_level‘

Pisanix v0.2.0 发布|新增动态读写分离支持

【Idea设置运行参数无效】可能是...

RSA306B,500,600系列API接口代码
随机推荐
字节API鉴权方法
图解 SQL,这也太形象了吧!
长期更新的一些 pytorch 知识点总结
B 站又上热搜了, HR 称「核心用户都是 Loser」
ICDE‘22推荐系统论文之Research篇
IP报文头解析
5 基本引用类型
阿尔萨斯监控平台&普罗米修斯监控平台对服务器资源的监控
功率放大器的设计要点
跟我学 UML 系统建模
C# 写系统日志
【Idea设置运行参数无效】可能是...
DevOps平台中的制品库是什么?有什么用处?
AAAI‘22 推荐系统论文梳理
Real-Time Rendering 4th相关资源整理(无需积分 传火)
学 Go,最常用的技能是什么?打日志
分支控制if-else
GET 和 POST 请求的区别
Typora收费?搭建VS Code MarkDown写作环境
如何实时监控销售数据?销售看板来帮你!