File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ apply_split: split.py clean
77
77
78
78
run : first_pages run.py
79
79
@echo " Starting Flask development server..."
80
- $(PYTHON ) run.py
80
+ $(PYTHON ) run.py --kwargs text_mode=plain
81
81
82
82
# Clean up pyc files and __pycache__ directories
83
83
clean :
Original file line number Diff line number Diff line change @@ -140,13 +140,15 @@ def save_colors():
140
140
@app .route ("/metadata-for-page/<int:page_num>" )
141
141
def metadata_for_page (page_num : int ):
142
142
view_selection = 0
143
+ text_mode = flor .arg ("text_mode" , default = "plain" ).strip ().lower ()
144
+ assert text_mode in ("ocr" , "plain" )
143
145
with warnings .catch_warnings ():
144
146
warnings .simplefilter ("ignore" , UserWarning )
145
147
record = memoized_pdfs [memoized_pdfs ["document_value" ] == pdf_names [- 1 ]][
146
148
memoized_pdfs ["page" ] == page_num + 1
147
149
].to_dict (orient = "records" )[0 ]
148
150
if view_selection == 0 :
149
- if "page_ocr" in record :
151
+ if text_mode == "ocr" :
150
152
return jsonify ([{f"ocr-page-{ page_num + 1 } " : record ["page_ocr" ]}])
151
153
else :
152
154
return jsonify ([{f"txt-page-{ page_num + 1 } " : record ["page_text" ]}])
You can’t perform that action at this time.
0 commit comments