|
import gradio as gr |
|
import cv2 |
|
from PIL import Image |
|
import numpy as np |
|
from EasyOpticalCharacterRecognition import process_image |
|
|
|
def infer(image): |
|
img = np.array(image) |
|
annotated_img, result_text = process_image(img) |
|
return Image.fromarray(annotated_img), result_text |
|
|
|
demo = gr.Interface( |
|
fn=infer, |
|
inputs=gr.Image(type="pil"), |
|
outputs=[gr.Image(type="pil", label="Annotated Image"), gr.Textbox(label="Classification Results")], |
|
title="Handwritten vs Computerized Text Detector", |
|
description="Upload an image containing text. The system detects text using EasyOCR and classifies each as handwritten or computerized using MobileNet." |
|
) |
|
demo.launch() |