Spaces:
Sleeping
Sleeping
examples added
Browse files
app.py
CHANGED
|
@@ -4,6 +4,9 @@ import numpy as np
|
|
| 4 |
import cv2
|
| 5 |
import gradio as gr
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
def get_response(input_img):
|
| 8 |
|
| 9 |
'''
|
|
@@ -53,11 +56,14 @@ def get_response(input_img):
|
|
| 53 |
|
| 54 |
|
| 55 |
if __name__ == "__main__":
|
|
|
|
| 56 |
text_detector=Text_Detection('models/text_detector.xml')
|
| 57 |
ocr=OCR('models/ocr.xml')
|
| 58 |
iface = gr.Interface(
|
|
|
|
| 59 |
fn=get_response,
|
| 60 |
inputs=gr.Image(type="numpy"), # Accepts image input
|
|
|
|
| 61 |
outputs=[gr.Textbox(),gr.Image(type="numpy")],
|
| 62 |
title="Latin Text Detection & Recognition",
|
| 63 |
description="Upload images for fast & accurate English(Latin) OCR. Works best with image format of invoice, documents"
|
|
|
|
| 4 |
import cv2
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
+
def show_example(path):
|
| 8 |
+
return cv2.cvtColor(cv2.imread(path), cv2.COLOR_BGR2RGB)
|
| 9 |
+
|
| 10 |
def get_response(input_img):
|
| 11 |
|
| 12 |
'''
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
if __name__ == "__main__":
|
| 59 |
+
|
| 60 |
text_detector=Text_Detection('models/text_detector.xml')
|
| 61 |
ocr=OCR('models/ocr.xml')
|
| 62 |
iface = gr.Interface(
|
| 63 |
+
cache_examples=False,
|
| 64 |
fn=get_response,
|
| 65 |
inputs=gr.Image(type="numpy"), # Accepts image input
|
| 66 |
+
examples=[[show_example('elron.png')]],
|
| 67 |
outputs=[gr.Textbox(),gr.Image(type="numpy")],
|
| 68 |
title="Latin Text Detection & Recognition",
|
| 69 |
description="Upload images for fast & accurate English(Latin) OCR. Works best with image format of invoice, documents"
|