ujjawal07's picture
Upload 3 files
4f2a63e
Raw
History Blame Contribute Delete
597 Bytes
import gradio as gr
from PIL import Image
import pytesseract
def recognize_text(image):
img = Image.fromarray(image.astype('uint8'), 'RGB')
text = pytesseract.image_to_string(img)
return text
input_image = gr.inputs.Image()
output_text = gr.outputs.Textbox()
interface = gr.Interface(
fn=recognize_text,
inputs=input_image,
outputs=output_text,
title='Image Text Recognition',
description='Upload an image to recognize text from it.',
examples=[['image/image4.jpg']],
allow_flagging=False
)
if __name__ == '__main__':
interface.launch(share=True)