Spaces:
Runtime error
Runtime error
fix: ignore post-processing for cord
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ def run_prediction(sample):
|
|
36 |
# post-processing
|
37 |
if "cord" in task_prompt:
|
38 |
prediction = prediction.replace(processor.tokenizer.eos_token, "").replace(processor.tokenizer.pad_token, "")
|
39 |
-
prediction = re.sub(r"<.*?>", "", prediction, count=1).strip() # remove first task start token
|
40 |
prediction = processor.token2json(prediction)
|
41 |
|
42 |
# load reference target
|
@@ -101,6 +101,6 @@ if information == 'Extract all!':
|
|
101 |
st.text(f'\nRaw output a:\n{parsed_receipt_info_a}')
|
102 |
st.text(f'\nRaw output b:\n{parsed_receipt_info_b}')
|
103 |
else:
|
104 |
-
st.text(f'parsing receipt
|
105 |
parsed_receipt_info = run_prediction(image)
|
106 |
st.text(f'\nRaw output:\n{parsed_receipt_info}')
|
|
|
36 |
# post-processing
|
37 |
if "cord" in task_prompt:
|
38 |
prediction = prediction.replace(processor.tokenizer.eos_token, "").replace(processor.tokenizer.pad_token, "")
|
39 |
+
# prediction = re.sub(r"<.*?>", "", prediction, count=1).strip() # remove first task start token
|
40 |
prediction = processor.token2json(prediction)
|
41 |
|
42 |
# load reference target
|
|
|
101 |
st.text(f'\nRaw output a:\n{parsed_receipt_info_a}')
|
102 |
st.text(f'\nRaw output b:\n{parsed_receipt_info_b}')
|
103 |
else:
|
104 |
+
st.text(f'parsing receipt...')
|
105 |
parsed_receipt_info = run_prediction(image)
|
106 |
st.text(f'\nRaw output:\n{parsed_receipt_info}')
|