Spaces:
Build error
Build error
napatswift
commited on
Commit
•
dc45c07
1
Parent(s):
e7d3991
Fix put text bug
Browse files
main.py
CHANGED
@@ -2,9 +2,8 @@ from mmocr.ocr import MMOCR
|
|
2 |
import gradio as gr
|
3 |
import cv2
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
det_ckpt=f'{model_dir}/epoch_40.pth', device='cpu')
|
8 |
def get_rec(points):
|
9 |
xs = []
|
10 |
ys = []
|
@@ -28,7 +27,7 @@ def predict(image_input, score_threshold):
|
|
28 |
|
29 |
p0, p1 = get_rec([int(i) for i in polygon])
|
30 |
draw_img = cv2.rectangle(draw_img, p0, p1, (255,0,0), 2)
|
31 |
-
draw_img = cv2.putText(draw_img, '%.3f' % score, p0, cv2.FONT_HERSHEY_PLAIN, 2)
|
32 |
return draw_img
|
33 |
|
34 |
def run():
|
|
|
2 |
import gradio as gr
|
3 |
import cv2
|
4 |
|
5 |
+
ocr = MMOCR(det_config='model/config.py',
|
6 |
+
det_ckpt='model/epoch_40.pth', device='cpu')
|
|
|
7 |
def get_rec(points):
|
8 |
xs = []
|
9 |
ys = []
|
|
|
27 |
|
28 |
p0, p1 = get_rec([int(i) for i in polygon])
|
29 |
draw_img = cv2.rectangle(draw_img, p0, p1, (255,0,0), 2)
|
30 |
+
draw_img = cv2.putText(draw_img, '%.3f' % score, p0, cv2.FONT_HERSHEY_PLAIN, 2, (0, 255, 0))
|
31 |
return draw_img
|
32 |
|
33 |
def run():
|