gpyocr / app.py
Omnibus's picture
Update app.py
b3d9f15 verified
raw
history blame contribute delete
650 Bytes
import cv2
import gpyocr
import gradio as gr
def tess(inp):
outp = gpyocr.tesseract_ocr(f'{inp}')
return outp
def goog(inp):
outp = gpyocr.google_vision_ocr(f'{inp}')
return outp
def sel(togg,inp):
if togg == 'tesseract':
return tess(inp)
if togg == 'g vision':
return goog(inp)
with gr.Block() as app:
with gr.Row():
with gr.Column():
inp = gr.Image(type='filepath')
outp = gr.Textbox()
with gr.Column():
togg = gr.Radio(choices=['tesseract','g vision'], value='tesseract')
btn = gr.Button()
btn.click(sel,[togg,inp],outp)
app.launch()