|
import os |
|
import gradio as gr |
|
|
|
def inference(filepath): |
|
return os.popen(f'djpeg {filepath} | gocr -').read().strip() |
|
|
|
title = "GOCR" |
|
description = "Gradio demo for GOCR. GOCR is an OCR (Optical Character Recognition) program, developed under the GNU Public License. It converts scanned images of text back to text files." |
|
article = "<p style='text-align: center'><a href='http://jocr.sourceforge.net/' target='_blank'>GOCR</a></p>" |
|
gr.Interface( |
|
inference, |
|
[gr.inputs.Image(type="filepath", label="Input")], |
|
'text', |
|
title=title, |
|
description=description, |
|
article=article, |
|
examples=['handwrt1.jpg'] |
|
).launch(enable_queue=True,cache_examples=True) |