Spaces:
Running
Running
Add models
Browse files- app.py +34 -20
- models/text_det/ch_PP-OCRv2_det_infer.onnx +3 -0
- models/text_det/ch_PP-OCRv3_det_infer.onnx +3 -0
- models/text_det/ch_ppocr_server_v2.0_det_infer.onnx +3 -0
- models/text_rec/ch_PP-OCRv2_rec_infer.onnx +3 -0
- models/text_rec/ch_PP-OCRv3_rec_infer.onnx +3 -0
- models/text_rec/ch_ppocr_server_v2.0_rec_infer.onnx +3 -0
app.py
CHANGED
@@ -115,30 +115,44 @@ with gr.Blocks(title='RapidOCR') as demo:
|
|
115 |
- Python: 3.8
|
116 |
- onnxruntime: 1.14.1
|
117 |
- rapidocr_onnxruntime: 1.2.5""")
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
button = gr.Button('Submit')
|
138 |
button.click(fn=inference,
|
139 |
inputs=[input_img, box_thresh, unclip_ratio, text_score],
|
140 |
outputs=[out_img, out_txt])
|
141 |
-
|
142 |
gr.Examples(examples=examples,
|
143 |
inputs=[input_img, box_thresh, unclip_ratio, text_score],
|
144 |
outputs=[out_img, out_txt], fn=inference)
|
|
|
115 |
- Python: 3.8
|
116 |
- onnxruntime: 1.14.1
|
117 |
- rapidocr_onnxruntime: 1.2.5""")
|
118 |
+
gr.Markdown('### 超参数调节')
|
119 |
+
with gr.Row():
|
120 |
+
box_thresh = gr.Slider(minimum=0, maximum=1.0, value=0.5,
|
121 |
+
label='box_thresh', step=0.1,
|
122 |
+
interactive=True,
|
123 |
+
info='[0, 1.0]')
|
124 |
+
unclip_ratio = gr.Slider(minimum=1.5, maximum=2.0, value=1.6,
|
125 |
+
label='unclip_ratio', step=0.1,
|
126 |
+
interactive=True,
|
127 |
+
info='[1.5, 2.0]')
|
128 |
+
text_score = gr.Slider(minimum=0, maximum=1.0, value=0.5,
|
129 |
+
label='text_score', step=0.1,
|
130 |
+
interactive=True,
|
131 |
+
info='[0, 1.0]')
|
132 |
+
|
133 |
+
gr.Markdown('### 模型选择')
|
134 |
+
with gr.Row():
|
135 |
+
text_det = gr.Dropdown(['ch_PP-OCRv3_det_infer.onnx',
|
136 |
+
'ch_PP-OCRv2_det_infer.onnx',
|
137 |
+
'ch_ppocr_server_v2.0_det_infer.onnx'],
|
138 |
+
label='选择文本检测模型',
|
139 |
+
value='ch_PP-OCRv3_det_infer.onnx',
|
140 |
+
interactive=True)
|
141 |
+
text_rec = gr.Dropdown(['ch_PP-OCRv3_rec_infer.onnx',
|
142 |
+
'ch_PP-OCRv2_rec_infer.onnx',
|
143 |
+
'ch_ppocr_server_v2.0_rec_infer.onnx'],
|
144 |
+
label='选择文本识别模型',
|
145 |
+
value='ch_PP-OCRv3_rec_infer.onnx',
|
146 |
+
interactive=True)
|
147 |
+
|
148 |
+
with gr.Row():
|
149 |
+
input_img = gr.Image(type='filepath', label='Input')
|
150 |
+
out_img = gr.Image(type='filepath', label='Output')
|
151 |
+
out_txt = gr.outputs.Textbox(type='text', label='RecText')
|
152 |
button = gr.Button('Submit')
|
153 |
button.click(fn=inference,
|
154 |
inputs=[input_img, box_thresh, unclip_ratio, text_score],
|
155 |
outputs=[out_img, out_txt])
|
|
|
156 |
gr.Examples(examples=examples,
|
157 |
inputs=[input_img, box_thresh, unclip_ratio, text_score],
|
158 |
outputs=[out_img, out_txt], fn=inference)
|
models/text_det/ch_PP-OCRv2_det_infer.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:43d01120eab9f00e8d7541ad0f906dd9c7f28394233e47279073fab73f82da87
|
3 |
+
size 2341867
|
models/text_det/ch_PP-OCRv3_det_infer.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3439588c030faea393a54515f51e983d8e155b19a2e8aba7891934c1cf0de526
|
3 |
+
size 2432880
|
models/text_det/ch_ppocr_server_v2.0_det_infer.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0a7e74057c1f4e17f38bf3e0a9f500e64e83159e4fd58775f4953f13438370ca
|
3 |
+
size 48866380
|
models/text_rec/ch_PP-OCRv2_rec_infer.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:86eec59d02644a8890d54f4aa5fe7402cf2848450fc7ac613d4677cd6025b3da
|
3 |
+
size 8402009
|
models/text_rec/ch_PP-OCRv3_rec_infer.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:897a3ededb38fee0dae2c1ccee38241f37df202c9509e3abca02e9217c5ee615
|
3 |
+
size 10690752
|
models/text_rec/ch_ppocr_server_v2.0_rec_infer.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d0714a2b44f5d7ac7a17e44d0e1961393447590c895f4197f37e855e3464f53
|
3 |
+
size 111590126
|