Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from craft_hw_ocr import OCR
|
3 |
|
4 |
+
trocr = OCR.load_TrOCRmodel()
|
|
|
5 |
|
6 |
+
def do_ocr(inp):
|
7 |
+
img, results = OCR.craft_detection(inp)
|
8 |
+
bboxes, text = OCR.text_recoginition(img, results, trocr[0], trocr[1])
|
9 |
+
return OCR.visualize(img, results), text
|
10 |
+
|
11 |
+
inputs = gr.inputs.Image()
|
12 |
+
o1 = gr.outputs.Image()
|
13 |
+
o2 = gr.outputs.Textbox()
|
14 |
+
gr.Interface(fn=predict, inputs=inputs, outputs=[o1, o2]).launch()
|