Akbartus commited on
Commit
21e6b2b
·
1 Parent(s): 43019ad

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import easyocr
3
+ import numpy as np
4
+
5
+ def perform_ocr(image):
6
+ reader = easyocr.Reader(['en'], gpu=False)
7
+ result = reader.readtext(image)
8
+ ocr_text = '\n'.join([entry[1] for entry in result])
9
+ return ocr_text
10
+
11
+
12
+ with gr.Blocks() as demo:
13
+ with gr.Tab("Extract Text"):
14
+ image_input = gr.inputs.Image()
15
+ text_output = gr.outputs.Textbox()
16
+ button = gr.Button("Perform OCR")
17
+
18
+ button.click(perform_ocr, inputs=image_input, outputs=text_output)
19
+
20
+ demo.launch()