laverdes commited on
Commit
f756684
·
1 Parent(s): 274b32c

fix: pretrained_model unknown in extract all mode, markdown test

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -89,16 +89,17 @@ else:
89
  pretrained_model_b = VisionEncoderDecoderModel.from_pretrained("naver-clova-ix/donut-base-finetuned-cord-v2")
90
 
91
  device = "cuda" if torch.cuda.is_available() else "cpu"
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>"
 
99
  parsed_receipt_info_b = run_prediction(image)
100
  st.write(f'\nRaw output a:\n{parsed_receipt_info_a}')
101
- st.write(f'\nRaw output b:\n{parsed_receipt_info_b}')
102
  else:
103
  st.text(f'parsing 🧾...')
104
  parsed_receipt_info = run_prediction(image)
 
89
  pretrained_model_b = VisionEncoderDecoderModel.from_pretrained("naver-clova-ix/donut-base-finetuned-cord-v2")
90
 
91
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
92
 
93
  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)