|
import gradio as gr |
|
|
|
from PIL import Image |
|
import pytesseract |
|
import cv2 |
|
import os |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def recognize(input_img): |
|
text = pytesseract.image_to_string(Image.open("./data/" + filename)) |
|
return input_img, text |
|
|
|
gradio_app = gr.Interface( |
|
recognize, |
|
inputs=gr.inputs.Textbox(lines=2, placeholder="Name Here..."), |
|
inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"), |
|
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)], |
|
|
|
inputs=[gr.Image(label="Upload an Image", type="pil")], |
|
outputs=[gr.Textbox(label="Text in the Image")], |
|
|
|
title="Extrate Text From Image", |
|
) |
|
|
|
if __name__ == "__main__": |
|
gradio_app.launch() |