laverdes commited on
Commit
4b73e05
·
1 Parent(s): ebb030c

chore: add receipt emojji

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -59,9 +59,9 @@ with st.sidebar:
59
  information = st.radio(
60
  "What information inside the are you interested in?",
61
  ('Receipt Summary', 'Receipt Menu Details', 'Extract all!'))
62
- receipt = st.selectbox('Pick one receipt', ['1', '2', '3', '4', '5', '6'], index=5)
63
 
64
- st.text(f'{information} mode is ON!\nTarget receipt: {receipt}\n(opening image @:./img/receipt-{receipt}.png)')
65
 
66
  image = Image.open(f"./img/receipt-{receipt}.jpg")
67
  st.image(image, caption='Your target receipt')
@@ -83,7 +83,6 @@ elif information == 'Receipt Menu Details':
83
  pretrained_model.to(device)
84
 
85
  else:
86
- # st.text(f'NotImplemented: soon you will be able to use it..')
87
  processor_a = DonutProcessor.from_pretrained("unstructuredio/donut-base-sroie")
88
  processor_b = DonutProcessor.from_pretrained("naver-clova-ix/donut-base-finetuned-cord-v2")
89
  pretrained_model_a = VisionEncoderDecoderModel.from_pretrained("unstructuredio/donut-base-sroie")
@@ -93,7 +92,7 @@ else:
93
  pretrained_model.to(device)
94
 
95
  if information == 'Extract all!':
96
- st.text(f'parsing receipt (extracting all)..')
97
  pretrained_model, processor, task_prompt = pretrained_model_a, processor_a, f"<s>"
98
  parsed_receipt_info_a = run_prediction(image)
99
  pretrained_model, processor, task_prompt = pretrained_model_b, processor_b, f"<s_cord-v2>"
@@ -101,6 +100,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}')
 
59
  information = st.radio(
60
  "What information inside the are you interested in?",
61
  ('Receipt Summary', 'Receipt Menu Details', 'Extract all!'))
62
+ receipt = st.selectbox('Pick one 🧾', ['1', '2', '3', '4', '5', '6'], index=5)
63
 
64
+ st.text(f'{information} mode is ON!\nTarget 🧾: {receipt}\n(opening image @:./img/receipt-{receipt}.png)')
65
 
66
  image = Image.open(f"./img/receipt-{receipt}.jpg")
67
  st.image(image, caption='Your target receipt')
 
83
  pretrained_model.to(device)
84
 
85
  else:
 
86
  processor_a = DonutProcessor.from_pretrained("unstructuredio/donut-base-sroie")
87
  processor_b = DonutProcessor.from_pretrained("naver-clova-ix/donut-base-finetuned-cord-v2")
88
  pretrained_model_a = VisionEncoderDecoderModel.from_pretrained("unstructuredio/donut-base-sroie")
 
92
  pretrained_model.to(device)
93
 
94
  if information == 'Extract all!':
95
+ st.text(f'parsing 🧾 (extracting all)...')
96
  pretrained_model, processor, task_prompt = pretrained_model_a, processor_a, f"<s>"
97
  parsed_receipt_info_a = run_prediction(image)
98
  pretrained_model, processor, task_prompt = pretrained_model_b, processor_b, f"<s_cord-v2>"
 
100
  st.text(f'\nRaw output a:\n{parsed_receipt_info_a}')
101
  st.text(f'\nRaw output b:\n{parsed_receipt_info_b}')
102
  else:
103
+ st.text(f'parsing 🧾...')
104
  parsed_receipt_info = run_prediction(image)
105
  st.text(f'\nRaw output:\n{parsed_receipt_info}')