Spaces:
Runtime error
Runtime error
JustinLin610
commited on
Commit
•
9d392d5
1
Parent(s):
d8481a6
debug
Browse files
app.py
CHANGED
@@ -169,7 +169,7 @@ def ocr(img, task):
|
|
169 |
out_img = Image.open(img)
|
170 |
if task == "General":
|
171 |
results = get_images(img, reader, text_confidence=0.7, text_threshold=0.43,
|
172 |
-
|
173 |
elif task == "Document":
|
174 |
results = get_images(img, reader, text_threshold=0.3, sharp=1.2,
|
175 |
contrast=1.2, space_ths=1.8)
|
@@ -201,8 +201,9 @@ description = "Gradio Demo for Chinese OCR based on OFA-Base. "\
|
|
201 |
"\n中文OCR体验区。欢迎上传图片,静待检测文字返回~"
|
202 |
article = "<p style='text-align: center'><a href='https://github.com/OFA-Sys/OFA' target='_blank'>OFA Github " \
|
203 |
"Repo</a></p> "
|
204 |
-
examples = [['shupai.png'], ['chinese.jpg'], ['gaidao.jpeg'
|
205 |
-
['benpao.jpeg'], ['wanli.png'
|
|
|
206 |
io = gr.Interface(fn=ocr, inputs=[gr.inputs.Image(type='filepath', label='Image'),
|
207 |
gr.inputs.Radio(choices=['General', 'Document'], type='value', default='General', label='Domain')],
|
208 |
outputs=[gr.outputs.Image(type='pil', label='Image'),
|
|
|
169 |
out_img = Image.open(img)
|
170 |
if task == "General":
|
171 |
results = get_images(img, reader, text_confidence=0.7, text_threshold=0.43,
|
172 |
+
link_threshold=0.43, slope_ths=0., add_margin=0.02)
|
173 |
elif task == "Document":
|
174 |
results = get_images(img, reader, text_threshold=0.3, sharp=1.2,
|
175 |
contrast=1.2, space_ths=1.8)
|
|
|
201 |
"\n中文OCR体验区。欢迎上传图片,静待检测文字返回~"
|
202 |
article = "<p style='text-align: center'><a href='https://github.com/OFA-Sys/OFA' target='_blank'>OFA Github " \
|
203 |
"Repo</a></p> "
|
204 |
+
examples = [['shupai.png', 'General'], ['chinese.jpg', 'General'], ['gaidao.jpeg', 'General'],
|
205 |
+
['qiaodaima.png', 'General'], ['benpao.jpeg', 'General'], ['wanli.png', 'General'],
|
206 |
+
['xsd.jpg', 'General']]
|
207 |
io = gr.Interface(fn=ocr, inputs=[gr.inputs.Image(type='filepath', label='Image'),
|
208 |
gr.inputs.Radio(choices=['General', 'Document'], type='value', default='General', label='Domain')],
|
209 |
outputs=[gr.outputs.Image(type='pil', label='Image'),
|