tencent_ocr/README.md
2025-01-15 11:12:45 +08:00

44 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 腾讯手写识别接口转接
1. 输入图片的BASE64返回识别结果
2. 使用JSON POST传输返回JSON符合restful风格
3. 入参:
- 图片的BASE64string
- Scene场景默认是null可选only_hwstring
- apikey: 测试期间设置为固定值1234567890string
4. 出参:
- 识别结果string
- 成功与否boolean
6. 使用腾讯通用手写体识别OCR SDK进行图像识别 使用go语言gin框架开发
7. 流程:
- 应用接收到POST数据以后校验数据的合法性json格式、base64格式等
- 调用腾讯通用手写体识别OCR SDK进行图像识别
- 再调用google gemini的api进行组织语言去除可能识别的错误。使用如下prompt
```
你是一个专业的助手负责纠正OCR识别结果中的文本。只需要输出识别结果不需要输出任何解释。
```
- 返回识别结果。
8. google gemini的api key"your key"
9. tencentSecretId = "your id",tencentSecretKey = "your secret"
10. key存储在.env文件中使用dotenv库进行加载。
11. 增加rate功能批改作文
```
项目结构
```
tencenthw/
├── go.mod
├── go.sum
├── cmd/
│ └── server/
│ └── main.go
└── pkg/
├── config/
│ └── config.go
└── handler/
└── ocr.go
└── rate.go
```