laverdes commited on
Commit
0efa4b1
1 Parent(s): a7fdfc4

chore: new messages as info

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -87,24 +87,24 @@ with st.sidebar:
87
  if img_file_buffer:
88
  # To read image file buffer as a PIL Image:
89
  photo = Image.open(img_file_buffer)
90
- print("picture taken!")
91
 
92
  st.text(f'{information} mode is ON!\nTarget 🧾: {receipt}') # \n(opening image @:./img/receipt-{receipt}.png)')
93
 
94
- if photo:
95
- image = photo
96
- print("photo loaded to image")
97
- elif image_upload:
98
- image = image_upload
99
- else:
100
- image = Image.open(f"./img/receipt-{receipt}.jpg")
101
-
102
  col1, col2 = st.columns(2)
103
 
104
- with col1:
105
- st.image(image, caption='Your target receipt')
 
 
 
 
 
 
 
 
106
 
107
- st.text(f'baking the 🍩s...')
108
 
109
  if information == 'Receipt Summary':
110
  processor = DonutProcessor.from_pretrained("unstructuredio/donut-base-sroie")
@@ -130,7 +130,7 @@ else:
130
 
131
  with col2:
132
  if information == 'Extract all':
133
- st.text(f'parsing 🧾 (extracting all)...')
134
  pretrained_model, processor, task_prompt = pretrained_model_a, processor_a, f"<s>"
135
  pretrained_model.to(device)
136
  parsed_receipt_info_a, _ = run_prediction(image)
@@ -142,7 +142,7 @@ with col2:
142
  st.text(f'\nReceipt Menu Details:')
143
  st.json(parsed_receipt_info_b)
144
  else:
145
- st.text(f'parsing 🧾...')
146
  parsed_receipt_info, _ = run_prediction(image)
147
  st.text(f'\n{information}')
148
  st.json(parsed_receipt_info)
 
87
  if img_file_buffer:
88
  # To read image file buffer as a PIL Image:
89
  photo = Image.open(img_file_buffer)
90
+ st.info("picture taken!")
91
 
92
  st.text(f'{information} mode is ON!\nTarget 🧾: {receipt}') # \n(opening image @:./img/receipt-{receipt}.png)')
93
 
 
 
 
 
 
 
 
 
94
  col1, col2 = st.columns(2)
95
 
96
+ with st.spinner('Loading image...'):
97
+ if photo:
98
+ image = photo
99
+ st.info("photo loaded to image")
100
+ elif image_upload:
101
+ image = image_upload
102
+ else:
103
+ image = Image.open(f"./img/receipt-{receipt}.jpg")
104
+ with col1:
105
+ st.image(image, caption='Your target receipt')
106
 
107
+ st.info(f'baking the 🍩s...')
108
 
109
  if information == 'Receipt Summary':
110
  processor = DonutProcessor.from_pretrained("unstructuredio/donut-base-sroie")
 
130
 
131
  with col2:
132
  if information == 'Extract all':
133
+ st.info(f'parsing 🧾 (extracting all)...')
134
  pretrained_model, processor, task_prompt = pretrained_model_a, processor_a, f"<s>"
135
  pretrained_model.to(device)
136
  parsed_receipt_info_a, _ = run_prediction(image)
 
142
  st.text(f'\nReceipt Menu Details:')
143
  st.json(parsed_receipt_info_b)
144
  else:
145
+ st.info(f'parsing 🧾...')
146
  parsed_receipt_info, _ = run_prediction(image)
147
  st.text(f'\n{information}')
148
  st.json(parsed_receipt_info)