Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ def modifier(input_file):
|
|
| 54 |
new_result = pd.DataFrame({'人名': names, '步数': steps})
|
| 55 |
|
| 56 |
#打印新的数据框
|
| 57 |
-
|
| 58 |
return new_result
|
| 59 |
|
| 60 |
|
|
@@ -83,16 +83,21 @@ def ocr(image):
|
|
| 83 |
|
| 84 |
result = pd.DataFrame(ocr_result, columns=['Box ID', 'Text'])
|
| 85 |
|
| 86 |
-
# save
|
| 87 |
file_path1 = 'output_orignal.xlsx'
|
| 88 |
result.to_excel(file_path1, index=False)
|
| 89 |
|
| 90 |
-
# save new_file
|
| 91 |
new_result = modifier(result)
|
| 92 |
file_path2 = 'output.xlsx'
|
| 93 |
new_result.to_excel(file_path2, index=False)
|
| 94 |
return out_img, new_result
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
title = "图片识别文字"
|
| 98 |
io = gr.Interface(fn=ocr, inputs=gr.inputs.Image(type='filepath', label='Image'),
|
|
|
|
| 54 |
new_result = pd.DataFrame({'人名': names, '步数': steps})
|
| 55 |
|
| 56 |
#打印新的数据框
|
| 57 |
+
print(new_result)
|
| 58 |
return new_result
|
| 59 |
|
| 60 |
|
|
|
|
| 83 |
|
| 84 |
result = pd.DataFrame(ocr_result, columns=['Box ID', 'Text'])
|
| 85 |
|
| 86 |
+
# save version1
|
| 87 |
file_path1 = 'output_orignal.xlsx'
|
| 88 |
result.to_excel(file_path1, index=False)
|
| 89 |
|
|
|
|
| 90 |
new_result = modifier(result)
|
| 91 |
file_path2 = 'output.xlsx'
|
| 92 |
new_result.to_excel(file_path2, index=False)
|
| 93 |
return out_img, new_result
|
| 94 |
|
| 95 |
+
# # save version2
|
| 96 |
+
# original_list = list(result['Text'])
|
| 97 |
+
# new_list = []
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
|
| 102 |
title = "图片识别文字"
|
| 103 |
io = gr.Interface(fn=ocr, inputs=gr.inputs.Image(type='filepath', label='Image'),
|