rosemariafontana commited on
Commit
f3e1856
Β·
verified Β·
1 Parent(s): f991e85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -71,25 +71,25 @@ def parse_ticket_image(image, question):
71
 
72
  # Use the model to answer each question
73
  answers = {}
74
- for i, q in enumerate(questions):
75
  answer_text = process_question(q, document)
76
  print(f"Answer Text extracted here: {answer_text}")
77
- answers[i] = answer_text
78
 
79
 
80
- ticket_number = answers[0]
81
- grain_type = answers[1]
82
- date = answers[2]
83
- time = answers[3]
84
- gross_weight = answers[4]
85
- tare_weight = answers[5]
86
- net_weight = answers[6]
87
- moisture = answers[7]
88
- damage = answers[8]
89
- gross_units = answers[9]
90
- dock_units = answers[10]
91
- comment = answers[11]
92
- assembly_number = answers[12]
93
 
94
 
95
  # Create a structured format (like a table) using pandas
 
71
 
72
  # Use the model to answer each question
73
  answers = {}
74
+ for q in questions:
75
  answer_text = process_question(q, document)
76
  print(f"Answer Text extracted here: {answer_text}")
77
+ answers[q] = answer_text
78
 
79
 
80
+ ticket_number = answers["What is the ticket number?"]
81
+ grain_type = answers["What is the type of grain (For example: corn, soy, wheat)?"]
82
+ date = answers["What is the date?"]
83
+ time = answers["What is the time?"]
84
+ gross_weight = answers["What is the gross weight?"]
85
+ tare_weight = answers["What is the tare weight?"]
86
+ net_weight = answers["What is the net weight?"]
87
+ moisture = answers["What is the moisture (moist) percentage?"]
88
+ damage = answers["What is the damage percentage?"]
89
+ gross_units = answers["What is the gross units?"]
90
+ dock_units = answers["What is the dock units?"]
91
+ comment = answers["What is the comment?"]
92
+ assembly_number = answers["What is the assembly number?"]
93
 
94
 
95
  # Create a structured format (like a table) using pandas