Ankur Goyal commited on
Commit
d6edad9
1 Parent(s): 47b5f74

Empty the question box

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -92,6 +92,8 @@ QUESTION_FILES = {
92
  FIELDS = {
93
  "Vendor Name": ["Vendor Name - Logo?", "Vendor Name - Address?"],
94
  "Vendor Address": ["Vendor Address?"],
 
 
95
  "Invoice Number": ["Invoice Number?"],
96
  "Invoice Date": ["Invoice Date?"],
97
  "Due Date": ["Due Date?"],
@@ -170,7 +172,7 @@ def process_question(
170
  question, document, img_gallery, model, fields, output, output_table
171
  ):
172
  if not question or document is None:
173
- return None, None, None
174
 
175
  text_value = None
176
  pages = [processing_utils.decode_base64_to_image(p) for p in img_gallery]
@@ -182,6 +184,7 @@ def process_question(
182
  output = {field_name: prediction, **output}
183
  table = [[field_name, prediction.get("answer")]] + output_table.values.tolist()
184
  return (
 
185
  gr.update(visible=True, value=pages),
186
  fields,
187
  output,
@@ -458,7 +461,7 @@ with gr.Blocks(css=CSS) as demo:
458
  question.submit(
459
  fn=process_question,
460
  inputs=[question, document, image, model, fields, output, output_table],
461
- outputs=[image, fields, output, output_table],
462
  )
463
 
464
  submit_button.click(
 
92
  FIELDS = {
93
  "Vendor Name": ["Vendor Name - Logo?", "Vendor Name - Address?"],
94
  "Vendor Address": ["Vendor Address?"],
95
+ "Customer Name": ["Customer Name?"],
96
+ "Customer Address": ["Customer Address?"],
97
  "Invoice Number": ["Invoice Number?"],
98
  "Invoice Date": ["Invoice Date?"],
99
  "Due Date": ["Due Date?"],
 
172
  question, document, img_gallery, model, fields, output, output_table
173
  ):
174
  if not question or document is None:
175
+ return None, None, None, None
176
 
177
  text_value = None
178
  pages = [processing_utils.decode_base64_to_image(p) for p in img_gallery]
 
184
  output = {field_name: prediction, **output}
185
  table = [[field_name, prediction.get("answer")]] + output_table.values.tolist()
186
  return (
187
+ None,
188
  gr.update(visible=True, value=pages),
189
  fields,
190
  output,
 
461
  question.submit(
462
  fn=process_question,
463
  inputs=[question, document, image, model, fields, output, output_table],
464
+ outputs=[question, image, fields, output, output_table],
465
  )
466
 
467
  submit_button.click(