File size: 683 Bytes
83eac12 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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() |