File size: 682 Bytes
0acd6c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)