Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to quickly build General character recognition Application with Serverless Framework+OCR

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Serverless Framework+OCR how to quickly build universal character recognition applications, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

In our daily work and life, character recognition is closely related to us, such as ID card recognition, random scanning, electronic paper documents and so on, all of which show the importance of character recognition technology. For this reason, Tencent Cloud universal character recognition product General OCR arises at the historic moment. Based on the deep learning technology at the forefront of the industry, it supports intelligent recognition of text content on images as editable text, which greatly improves the efficiency of information processing. The combination of Serverless Framework and OCR provides users with a convenient, fast and low-cost deployment scheme for general character recognition applications.

Why use Serverlesss Framework to build? let's take a look at the advantages of Serverlesss Framework:

0 configuration, flexible capacity expansion: Serverless Framework is developed based on cloud Serverless resources, so it can efficiently and quickly build OCR applications without complex configuration, and support flexible capacity expansion and reduction, reduce use costs, and help business launch.

Real-time monitoring, convenient for operation and maintenance: after deployment, you can view basic monitoring metrics and application-level monitoring metrics in real time through Serverless Dashboard, support real-time log output and remote debugging capabilities, shield the differences between local and cloud environments, and provide perfect troubleshooting functions.

Component-based development: provide component-based development and integration, easy for users to modify and reuse resources, and use more flexible.

Next, let's quickly build a character recognition application based on Tencent Cloud OCR through Serverless Framework Component.

The template mainly consists of the following components:

Serverless Express: RESTful API is implemented through the Express framework built by SCF and API gateway.

Serverless Website: the front end completes static Web site deployment by hosting React static pages to the COS object store.

Please confirm before actual combat:

Node.js version should be no less than 8.6. Node.js 10.0 or above is recommended.

Activate Tencent Cloud universal character recognition OCR service

Quickly build a character recognition application based on Tencent Cloud OCR. The specific steps are as follows:

1. Installation

To install Serverless Framework globally through npm:

Npm install-g serverless

After installation, check the version information of Serverless Framework by running the serverless-v command to ensure that the version information is not lower than the following version:

Serverless-vFramework Core: 1.67.3Plugin: 3.6.6SDK: 2.3.0Components: 2.30.12. Create a bucket

Log in to the COS console, create a new public bucket, select public read and write to store the uploaded images, and pay attention to the selection of region. Next, click "basic configuration" to configure cross-domain access CORS for buckets, as shown below:

3. Configuration

Create a new local folder and use the create-- template-url command to download the relevant template.

Serverless create-- template-url https://github.com/serverless-tencent/serverless-demos/serverless-ocr

Create a .env file in which you enter your account, key information, and a specified bucket (this bucket is used to store uploaded images)

# .envTENCENT _ APP_ID=xxxTENCENT_SECRET_ID=xxxTENCENT_SECRET_KEY=xxx# region of bucketREGION=ap-guangzhou# bucket name, using to store upload picturesBUCKET=ocr-images4. Download all npm dependencies on npm run bootstrap5. Deployment

Execute the sls deploy-- all command to deploy:

Sls deploy-- allserverless ⚡ frameworkbackend: region: ap-guangzhou apigw: serviceId: service-4i62q1pg subDomain: service-4i62q1pg-1258834142.gz.apigw.tencentcs.com environment: release url: https://service-4i62q1pg-1258834142.gz.apigw.tencentcs.com/release/ scf: functionName: serverless-ocr runtime: Nodejs10.15 namespace: defaultfrontend: region: ap-guangzhou website: https://serverless-ocr-1258834142.cos-website .ap-guangzhou.myqcloud.com38s > serverless-ocr > Success

After the deployment is successful, you can use a browser to visit the website link generated by the project to see the generated website. Click to upload pictures, and the project can complete text recognition through OCR SDK.

6. Remove

Execute sls remove-- all to quickly remove items.

Sls remove-- allserverless ⚡ framework38s > tencent-fullstack > Success is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report