mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-10 21:10:55 +08:00
docs: Update demo line and colab demo
This commit is contained in:
1 parent
81cea705a8
commit
2db34bfb28
3 files changed
+1
-157
No files matched your search
@@ -12,7 +12,6 @@
|
||||
<div> </div>
|
||||
|
||||
<a href="https://huggingface.co/spaces/SWHL/RapidOCRDemo" target="_blank"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Hugging Face Demo-blue"></a>
|
||||
<a href="https://www.modelscope.cn/studios/liekkas/RapidOCRDemo/summary" target="_blank"><img src="https://img.shields.io/badge/ModelScope-Demo-blue"></a>
|
||||
<a href="https://aistudio.baidu.com/app/highcode/33121" target="_blank"><img src="https://img.shields.io/badge/AI%20Studio-Demo-blue"></a>
|
||||
<a href="https://colab.research.google.com/github/RapidAI/RapidOCR/blob/main/assets/RapidOCRDemo.ipynb" target="_blank"><img src="https://raw.githubusercontent.com/RapidAI/RapidOCR/main/assets/colab-badge.svg" alt="Open in Colab"></a>
|
||||
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.13-aff.svg"></a>
|
||||
|
||||
+1
-155
@@ -1,155 +1 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "8H17bBI3N-vo"
|
||||
},
|
||||
"source": [
|
||||
"\n",
|
||||
"\n",
|
||||
"## RapidOCR Python Demo\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "0qapeJlG6JFJ"
|
||||
},
|
||||
"source": [
|
||||
"#### pip Install"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"id": "sTB1PsMp6XTT"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Looking in indexes: https://pypi.douban.com/simple/\n",
|
||||
"Collecting rapidocr_onnxruntime\n",
|
||||
" Downloading https://pypi.doubanio.com/packages/c5/ed/16c0d4c909ea626d35923d913295394f2ff40f605cd4036cb9d8ae7eab62/rapidocr_onnxruntime-1.1.18-py3-none-any.whl (12.3 MB)\n",
|
||||
" ---------------------------------------- 12.3/12.3 MB 2.7 MB/s eta 0:00:00\n",
|
||||
"Requirement already satisfied: numpy>=1.19.3 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.21.6)\n",
|
||||
"Requirement already satisfied: Shapely>=1.7.1 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.8.1.post1)\n",
|
||||
"Requirement already satisfied: opencv-python>=4.5.1.48 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (4.6.0.66)\n",
|
||||
"Requirement already satisfied: six>=1.15.0 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.16.0)\n",
|
||||
"Requirement already satisfied: onnxruntime>=1.7.0 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.10.0)\n",
|
||||
"Requirement already satisfied: pyclipper>=1.2.1 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.2.1)\n",
|
||||
"Requirement already satisfied: protobuf in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from onnxruntime>=1.7.0->rapidocr_onnxruntime) (3.20.0)\n",
|
||||
"Requirement already satisfied: flatbuffers in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from onnxruntime>=1.7.0->rapidocr_onnxruntime) (2.0)\n",
|
||||
"Installing collected packages: rapidocr_onnxruntime\n",
|
||||
"Successfully installed rapidocr_onnxruntime-1.1.18\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"'wget' �����ڲ����ⲿ���Ҳ���ǿ����еij���\n",
|
||||
"�����������\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!pip install rapidocr_onnxruntime -i https://pypi.douban.com/simple/\n",
|
||||
"!wget -O 2.jpg https://pic1.zhimg.com/v2-612e2d58bd9f5f4a99c448a4d626ce86_1440w.jpg?source=172ae18b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "PDlCLO_CewSk"
|
||||
},
|
||||
"source": [
|
||||
"#### Run as code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"colab": {
|
||||
"base_uri": "https://localhost:8080/",
|
||||
"height": 393
|
||||
},
|
||||
"id": "bbHGS0emSNTz",
|
||||
"outputId": "2a42df96-4962-463d-89fc-0cad8bdcd8d5"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[[58.0, 136.0], [482.0, 136.0], [482.0, 178.0], [58.0, 178.0]], '这时我看见他的背影,', '0.8524695634841919']\n",
|
||||
"[[[58.0, 214.0], [540.0, 216.0], [540.0, 258.0], [58.0, 256.0]], '我的泪很快地流下来了。', '0.8891244679689407']\n",
|
||||
"[[[57.0, 294.0], [396.0, 296.0], [396.0, 338.0], [57.0, 336.0]], '我赶紧干了泪,', '0.793162614107132']\n",
|
||||
"[[[59.0, 375.0], [253.0, 375.0], [253.0, 418.0], [59.0, 418.0]], '怕他看见,', '0.7794817586739858']\n",
|
||||
"[[[60.0, 455.0], [350.0, 457.0], [350.0, 497.0], [59.0, 495.0]], '也怕别人看见。', '0.8421911969780922']\n",
|
||||
"[[[70.0, 569.0], [189.0, 569.0], [189.0, 607.0], [70.0, 607.0]], '《背影》', '0.7730599045753479']\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import cv2\n",
|
||||
"from rapidocr_onnxruntime import RapidOCR\n",
|
||||
"\n",
|
||||
"rapid_ocr = RapidOCR()\n",
|
||||
"\n",
|
||||
"image_path = '2.jpg'\n",
|
||||
"img = cv2.imread(image_path)\n",
|
||||
"ocr_result, _ = rapid_ocr(img)\n",
|
||||
"\n",
|
||||
"for v in ocr_result:\n",
|
||||
" print(v)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"id": "nzSxM43V9rAL"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"colab": {
|
||||
"collapsed_sections": [],
|
||||
"name": "Copy of Copy of RapidOCRDemo.ipynb",
|
||||
"provenance": []
|
||||
},
|
||||
"kernelspec": {
|
||||
"display_name": "demo",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.13"
|
||||
},
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "d42ac74e361e91c495bc3239dc10e7028f0ad770b2a1f806c814d17578354ad7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
{"cells":[{"cell_type":"markdown","metadata":{"id":"8H17bBI3N-vo"},"source":["\n","\n","## RapidOCR Python Demo\n","\n"]},{"cell_type":"markdown","metadata":{"id":"0qapeJlG6JFJ"},"source":["#### Install rapidocr_onnxruntime"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"sTB1PsMp6XTT","outputId":"c17a3881-b441-4f22-eefe-c0844521c5bc"},"outputs":[{"name":"stdout","output_type":"stream","text":["Looking in indexes: https://pypi.douban.com/simple/\n","Collecting rapidocr_onnxruntime\n"," Downloading https://pypi.doubanio.com/packages/c5/ed/16c0d4c909ea626d35923d913295394f2ff40f605cd4036cb9d8ae7eab62/rapidocr_onnxruntime-1.1.18-py3-none-any.whl (12.3 MB)\n"," ---------------------------------------- 12.3/12.3 MB 2.7 MB/s eta 0:00:00\n","Requirement already satisfied: numpy>=1.19.3 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.21.6)\n","Requirement already satisfied: Shapely>=1.7.1 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.8.1.post1)\n","Requirement already satisfied: opencv-python>=4.5.1.48 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (4.6.0.66)\n","Requirement already satisfied: six>=1.15.0 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.16.0)\n","Requirement already satisfied: onnxruntime>=1.7.0 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.10.0)\n","Requirement already satisfied: pyclipper>=1.2.1 in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from rapidocr_onnxruntime) (1.2.1)\n","Requirement already satisfied: protobuf in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from onnxruntime>=1.7.0->rapidocr_onnxruntime) (3.20.0)\n","Requirement already satisfied: flatbuffers in e:\\anaconda3\\envs\\demo\\lib\\site-packages (from onnxruntime>=1.7.0->rapidocr_onnxruntime) (2.0)\n","Installing collected packages: rapidocr_onnxruntime\n","Successfully installed rapidocr_onnxruntime-1.1.18\n"]},{"name":"stderr","output_type":"stream","text":["'wget' �����ڲ����ⲿ���Ҳ���ǿ����еij���\n","���������ļ���\n"]}],"source":["!pip install rapidocr_onnxruntime\n","!wget -O 2.jpg https://pic1.zhimg.com/v2-612e2d58bd9f5f4a99c448a4d626ce86_1440w.jpg?source=172ae18b\n","!wget https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/FZYTK.TTF"]},{"cell_type":"markdown","metadata":{"id":"PDlCLO_CewSk"},"source":["#### Run"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":359},"id":"bbHGS0emSNTz","outputId":"a1ad3cc8-054d-4bec-a3f3-aed5cb30862f","executionInfo":{"status":"ok","timestamp":1727396511860,"user_tz":-480,"elapsed":4846,"user":{"displayName":"","userId":""}}},"outputs":[{"output_type":"stream","name":"stdout","text":["[[[[660.0, 15.0], [686.0, 14.0], [688.0, 83.0], [662.0, 84.0]], '格招打', 0.8068139], [[[57.0, 134.0], [484.0, 136.0], [484.0, 178.0], [57.0, 176.0]], '这时我看见他的背影,', 0.99692094], [[[60.0, 217.0], [538.0, 217.0], [538.0, 256.0], [60.0, 256.0]], '我的泪很快地流下来了。', 0.9964092], [[[58.0, 294.0], [396.0, 296.0], [396.0, 339.0], [58.0, 337.0]], '我赶紧拭干了泪,', 0.98592407], [[[57.0, 372.0], [257.0, 374.0], [257.0, 420.0], [57.0, 418.0]], '怕他看见,', 0.9982783], [[[58.0, 453.0], [350.0, 455.0], [350.0, 498.0], [58.0, 496.0]], '也怕别人看见。', 0.9979418], [[[68.0, 568.0], [191.0, 568.0], [191.0, 609.0], [68.0, 609.0]], '《背影》', 0.9973544]]\n","[1.1213593499999206, 0.029864072799682617, 0.7594971656799316]\n"]},{"output_type":"execute_result","data":{"text/plain":["<matplotlib.image.AxesImage at 0x7c2a0dd4cdc0>"]},"metadata":{},"execution_count":2},{"output_type":"display_data","data":{"text/plain":["<Figure size 640x480 with 1 Axes>"],"image/png":"iVBORw0KGgoAAAANSUhEUgAAAigAAAEOCAYAAACjEOwzAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9eZxdRZn//z7nrr0v6U53OkmnO519IyEEEkhCNggh7KA4ijqOMzoO+h1lvvNT5uuG/hTHn446I191Rhx13AFFlkAICSRAQhISspKNpDtbp/d9ues5vz/OrdN1q+vcTpAtej+8Qt97Tp2qp6rOredTz/NUlWHbtk0WWWSRRRZZZJHFuwjmOy1AFllkkUUWWWSRhYosQckiiyyyyCKLLN51yBKULLLIIossssjiXYcsQckiiyyyyCKLLN51yBKULLLIIossssjiXYcsQckiiyyyyCKLLN51yBKULLLIIossssjiXYcsQckiiyyyyCKLLN51yBKULLLIIossssjiXYcsQckiiyyyyCKLLN51eEcJygMPPEBNTQ3hcJgrrriCHTt2vJPiZJFFFllkkUUW7xK8YwTlt7/9Lffccw9f+tKX2L17N5dccgmrV6+mpaXlnRIpiyyyyCKLLLJ4l8B4pw4LvOKKK1iwYAHf//73AbAsi/Hjx/OpT32Kz33ucxmftSyLxsZGCgoKMAzj7RA3iyyyyCKLLLL4E2HbNr29vVRVVWGamW0k/rdJpjTEYjF27drFvffe614zTZNVq1axbdu2Yemj0SjRaNT9fvbsWWbMmPG2yJpFFllkkUUWWby5OH36NOPGjcuY5h0hKG1tbSSTSSoqKtKuV1RUcPjw4WHp77//fu67775h10+dOkVhYeEbliNrfckiCw/YNpyvbdVI/S/7c8oiiyxGQE9PD+PHj6egoGDEtO8IQblQ3Hvvvdxzzz3ud1HBwsJCCgoKEF4qy7JIJpPE43GSySSWZbn/bNtG9WZZlqU1MQniYhjGiP9M0xzxuijDtu0LJkXiGVV2XT4ijbgnl/dGyv5zgFpnuY3eIe/mMLzdffPGyhuprS5cfrkv/hLfzSyy+EvLine truncated
|
||||
@@ -12,7 +12,6 @@
|
||||
<div> </div>
|
||||
|
||||
<a href="https://huggingface.co/spaces/SWHL/RapidOCRDemo" target="_blank"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Hugging Face Demo-blue"></a>
|
||||
<a href="https://www.modelscope.cn/studios/liekkas/RapidOCRDemo/summary" target="_blank"><img src="https://img.shields.io/badge/ModelScope-Demo-blue"></a>
|
||||
<a href="https://aistudio.baidu.com/app/highcode/33121" target="_blank"><img src="https://img.shields.io/badge/AI%20Studio-Demo-blue"></a>
|
||||
<a href="https://colab.research.google.com/github/RapidAI/RapidOCR/blob/main/assets/RapidOCRDemo.ipynb" target="_blank"><img src="https://raw.githubusercontent.com/RapidAI/RapidOCR/main/assets/colab-badge.svg" alt="Open in Colab"></a>
|
||||
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.13-aff.svg"></a>
|
||||
|
||||
Reference in new issue
Block a user