words_easyocr / app.py
bonrix's picture
Update app.py
ffbf49e
raw
history blame contribute delete
916 Bytes
import gradio as gr
import easyocr
def perform_ocr(image):
# Perform OCR using EasyOCR
reader = easyocr.Reader(['en'], gpu=False)
result = reader.readtext(image)
ocr_text = '\n'.join([entry[1] for entry in result])
return ocr_text
# Create an input component for uploading an image file
image_input = gr.inputs.Image()
# Create an output component to display the OCR text
text_output = gr.outputs.Textbox()
# Create the Gradio interface
iface = gr.Interface(fn=perform_ocr, inputs=image_input, outputs=text_output, title="OCR using EasyOCR", description = "OCR (Optical Character Recognition) application using EasyOCR library and Gradio for creating a simple web interface to interact with the OCR functionality. Gradio is a Python library that allows you to quickly create web interfaces for your machine learning models.Put image here and get a output.")
# Run the interface
iface.launch()