CoolFace
Apppublic

exaggerated/PaddleOCR

sourceHugging Faceupdated 3y agoView on Hugging Face
3likes
app.py34 linesDownload Raw Back to root
1import gradio as gr2 3from pp_ocr import inference_img, inference_json4 5title = "基于PP-OCRv3文本识别"6description = """7    PaddleOCR是百度开源的超轻量级OCR模型库,提供了数十种文本检测、识别模型,旨在打造一套丰富、领先、实用的文字检测、识别模型/工具库。8    > 项目地址:PaddleOCR github 地址: https://github.com/PaddlePaddle/PaddleOCR9"""10 11with gr.Blocks() as app:12    gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>"13                + title14                + "</h1>")15    gr.Markdown(description)16    with gr.Tab("图片"):17        with gr.Row():18            with gr.Column():19                img_input = gr.Image()20                img_btn = gr.Button("识别")21            with gr.Column():22                img_output = gr.Image(label="Result")23    with gr.Tab("JSON"):24        with gr.Row():25            with gr.Column():26                json_input = gr.Image()27                json_btn = gr.Button("识别")28            with gr.Column():29                json_output = gr.Json(label="Result")30 31    img_btn.click(inference_img, inputs=img_input, outputs=img_output)32    json_btn.click(inference_json, inputs=json_input, outputs=json_output)33 34app.launch()