ocr / app.py
lingjun.zlj
Add application file
afb39ec
raw
history blame contribute delete
316 Bytes
from PIL import Image
import gradio as gr
import pytesseract
def ocr(input_img):
pil_image = Image.fromarray(input_img.astype('uint8'))
gray_image = pil_image.convert('L')
text = pytesseract.image_to_string(gray_image)
return text
demo = gr.Interface(ocr, gr.Image(), outputs="text")
demo.launch()