File size: 402 Bytes
0f94953 e84172e 0f94953 e84172e 0f94953 e84172e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import gradio as gr
from craft_hw_ocr import OCR
trocr = OCR.load_TrOCRmodel()
def do_ocr(inp):
img, results = OCR.craft_detection(inp)
bboxes, text = OCR.text_recoginition(img, results, trocr[0], trocr[1])
return OCR.visualize(img, results), text
inputs = gr.inputs.Image()
o1 = gr.outputs.Image()
o2 = gr.outputs.Textbox()
gr.Interface(fn=predict, inputs=inputs, outputs=[o1, o2]).launch() |