File size: 316 Bytes
afb39ec
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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()