laverdes commited on
Commit
71bf396
·
1 Parent(s): f756684

feat: display pretty json objects

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -94,13 +94,16 @@ if information == 'Extract all!':
94
  st.text(f'parsing 🧾 (extracting all)...')
95
  pretrained_model, processor, task_prompt = pretrained_model_a, processor_a, f"<s>"
96
  pretrained_model.to(device)
97
- parsed_receipt_info_a = run_prediction(image)
98
  pretrained_model, processor, task_prompt = pretrained_model_b, processor_b, f"<s_cord-v2>"
99
  pretrained_model.to(device)
100
- parsed_receipt_info_b = run_prediction(image)
101
- st.write(f'\nRaw output a:\n{parsed_receipt_info_a}')
102
- st.markdown(f'\nRaw output b:\n{parsed_receipt_info_b}')
 
 
103
  else:
104
  st.text(f'parsing 🧾...')
105
- parsed_receipt_info = run_prediction(image)
106
- st.write(f'\nRaw output:\n{parsed_receipt_info}')
 
 
94
  st.text(f'parsing 🧾 (extracting all)...')
95
  pretrained_model, processor, task_prompt = pretrained_model_a, processor_a, f"<s>"
96
  pretrained_model.to(device)
97
+ parsed_receipt_info_a, _ = run_prediction(image)
98
  pretrained_model, processor, task_prompt = pretrained_model_b, processor_b, f"<s_cord-v2>"
99
  pretrained_model.to(device)
100
+ parsed_receipt_info_b, _ = run_prediction(image)
101
+ st.text(f'\nRaw output a:')
102
+ st.json(parsed_receipt_info_a)
103
+ st.text(f'\nRaw output b:')
104
+ st.json(parsed_receipt_info_b)
105
  else:
106
  st.text(f'parsing 🧾...')
107
+ parsed_receipt_info, _ = run_prediction(image)
108
+ st.text(f'\nRaw output')
109
+ st.json(parsed_receipt_info)