Spaces:
Runtime error
Runtime error
First model version
Browse files
app.py
CHANGED
@@ -8,8 +8,8 @@ os.system('python setup.py build develop --user')
|
|
8 |
|
9 |
import glob
|
10 |
import gradio as gr
|
11 |
-
from demo import get_model, preprocess, postprocess, load
|
12 |
-
from utils import Config, Logger, CharsetMapper
|
13 |
import cv2
|
14 |
import pandas as pd
|
15 |
from det_demo import DetDemo
|
@@ -40,9 +40,9 @@ def process_image(filepath):
|
|
40 |
|
41 |
# cut patch
|
42 |
#image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
43 |
-
patchs = [image[box[1]:box[3], box[0]:box[2], :] for box in result_boxes]
|
44 |
-
patchs = [cv2.resize(patch, (128,32)) for patch in patchs]
|
45 |
-
patchs = np.stack(patchs, axis=0).transpose(0,3,1,2)
|
46 |
'''
|
47 |
patchs = [image[box[1]:box[3], box[0]:box[2], :] for box in result_boxes]
|
48 |
patchs = [preprocess(patch, config.dataset_image_width, config.dataset_image_height) for patch in patchs]
|
@@ -57,12 +57,6 @@ def process_image(filepath):
|
|
57 |
visual_image = det_demo.visualization(image.copy(), result_polygons, result_masks, result_boxes)
|
58 |
cv2.imwrite('result.jpg', visual_image)
|
59 |
return 'result.jpg'#, pd.DataFrame(result_words)
|
60 |
-
|
61 |
-
|
62 |
-
img = image.convert('RGB')
|
63 |
-
img = preprocess(img, config.dataset_image_width, config.dataset_image_height)
|
64 |
-
res = model(img)
|
65 |
-
return postprocess(res, charset, 'alignment')[0][0]
|
66 |
|
67 |
title = "张博强毕设中期展示(文本识别部分)"
|
68 |
description = "西北工业大学航海学院张博强毕设,目前识别部分进度为复现abinet,本网页为abinet复现的可视化web端展示"
|
|
|
8 |
|
9 |
import glob
|
10 |
import gradio as gr
|
11 |
+
#from demo import get_model, preprocess, postprocess, load
|
12 |
+
#from utils import Config, Logger, CharsetMapper
|
13 |
import cv2
|
14 |
import pandas as pd
|
15 |
from det_demo import DetDemo
|
|
|
40 |
|
41 |
# cut patch
|
42 |
#image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
43 |
+
#patchs = [image[box[1]:box[3], box[0]:box[2], :] for box in result_boxes]
|
44 |
+
#patchs = [cv2.resize(patch, (128,32)) for patch in patchs]
|
45 |
+
#patchs = np.stack(patchs, axis=0).transpose(0,3,1,2)
|
46 |
'''
|
47 |
patchs = [image[box[1]:box[3], box[0]:box[2], :] for box in result_boxes]
|
48 |
patchs = [preprocess(patch, config.dataset_image_width, config.dataset_image_height) for patch in patchs]
|
|
|
57 |
visual_image = det_demo.visualization(image.copy(), result_polygons, result_masks, result_boxes)
|
58 |
cv2.imwrite('result.jpg', visual_image)
|
59 |
return 'result.jpg'#, pd.DataFrame(result_words)
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
title = "张博强毕设中期展示(文本识别部分)"
|
62 |
description = "西北工业大学航海学院张博强毕设,目前识别部分进度为复现abinet,本网页为abinet复现的可视化web端展示"
|