File size: 1,867 Bytes
b61c514
 
 
 
 
 
daf8121
b61c514
 
daf8121
 
b61c514
aefc59c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: PaddleOCR
emoji: 
colorFrom: pink
colorTo: green
sdk: gradio
sdk_version: 5.23.1
app_file: app.py
pinned: false
license: apache-2.0
short_description: Extract text from images in multiple languages
---

# PaddleOCR 智能文字识别

基于PaddleOCR的多语言文字识别应用,支持自动语言检测和Base64图像识别。

## 功能特点

- **多语言支持**:自动检测并识别中文、英文、法语、德语、韩语和日语
- **自动语言检测**:无需手动选择语言,系统会自动检测图像中的文字语言
- **Base64图像支持**:支持直接处理Base64编码的图像数据
- **双重输出**:同时提供文本结果和标注后的图像
- **美观界面**:优化的Gradio界面,提供良好的用户体验

## 安装与运行

### 安装依赖

```bash
# 安装Python依赖
pip install -r requirements.txt

# 安装系统依赖
apt-get update && apt-get install -y ffmpeg libsm6 libxext6
```

### 运行应用

```bash
python app.py
```

应用将在 http://localhost:7860 启动

## API使用方法

### 1. 图像上传API

```bash
curl -X POST "http://localhost:7860/api/predict" \
     -F "fn_index=0" \
     -F "data=@/path/to/your/image.jpg"
```

### 2. Base64图像API

```bash
curl -X POST "http://localhost:7860/api/predict" \
     -H "Content-Type: application/json" \
     -d '{
          "fn_index": 1,
          "data": ["YOUR_BASE64_STRING_HERE"]
        }'
```

## 示例

系统提供了三个示例图像:
- 英文示例 (en_example.jpg)
- 中文示例 (cn_example.jpg)
- 日语示例 (jp_example.jpg)

## 注意事项

- 首次运行时,系统会自动下载所需的OCR模型,这可能需要一些时间
- 为获得最佳识别效果,请确保图像清晰且文字部分对比度良好
- 自动语言检测功能可能对于混合语言或特殊字体的文本效果不佳