Spaces:
Runtime error
Runtime error
JustinLin610
commited on
Commit
•
8f7f77a
1
Parent(s):
2915058
debug
Browse files- app.py +5 -5
- paibian.jpeg +0 -0
- zuowen.jpg +0 -0
app.py
CHANGED
@@ -163,9 +163,9 @@ def apply_half(t):
|
|
163 |
return t
|
164 |
|
165 |
|
166 |
-
def ocr(
|
167 |
-
out_img = Image.open(
|
168 |
-
results = get_images(
|
169 |
box_list, image_list = zip(*results)
|
170 |
draw_boxes(out_img, box_list)
|
171 |
|
@@ -190,10 +190,10 @@ description = "Gradio Demo for OFA-OCR. Upload your own image or click any one o
|
|
190 |
"\"Submit\" and then wait for the generated OCR result. "
|
191 |
article = "<p style='text-align: center'><a href='https://github.com/OFA-Sys/OFA' target='_blank'>OFA Github " \
|
192 |
"Repo</a></p> "
|
193 |
-
examples = [['
|
194 |
io = gr.Interface(fn=ocr, inputs=gr.inputs.Image(type='filepath', label='Image'),
|
195 |
outputs=[gr.outputs.Image(type='pil', label='Image'), gr.outputs.Textbox(label="OCR result")],
|
196 |
title=title, description=description, article=article, examples=examples,
|
197 |
allow_flagging='never', allow_screenshot=False)
|
198 |
-
io.launch(cache_examples=
|
199 |
|
|
|
163 |
return t
|
164 |
|
165 |
|
166 |
+
def ocr(img):
|
167 |
+
out_img = Image.open(img)
|
168 |
+
results = get_images(img, reader, link_threshold=0.2)
|
169 |
box_list, image_list = zip(*results)
|
170 |
draw_boxes(out_img, box_list)
|
171 |
|
|
|
190 |
"\"Submit\" and then wait for the generated OCR result. "
|
191 |
article = "<p style='text-align: center'><a href='https://github.com/OFA-Sys/OFA' target='_blank'>OFA Github " \
|
192 |
"Repo</a></p> "
|
193 |
+
examples = [['shupai.png'], ['chinese.jpg'], ['ms2.jpg']]
|
194 |
io = gr.Interface(fn=ocr, inputs=gr.inputs.Image(type='filepath', label='Image'),
|
195 |
outputs=[gr.outputs.Image(type='pil', label='Image'), gr.outputs.Textbox(label="OCR result")],
|
196 |
title=title, description=description, article=article, examples=examples,
|
197 |
allow_flagging='never', allow_screenshot=False)
|
198 |
+
io.launch(cache_examples=False)
|
199 |
|
paibian.jpeg
DELETED
Binary file (132 kB)
|
|
zuowen.jpg
DELETED
Binary file (179 kB)
|
|