Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
| 75 |
answer_text = process_question(q, document)
|
| 76 |
print(f"Answer Text extracted here: {answer_text}")
|
| 77 |
-
answers[
|
| 78 |
|
| 79 |
|
| 80 |
-
ticket_number = answers[
|
| 81 |
-
grain_type = answers[
|
| 82 |
-
date = answers[
|
| 83 |
-
time = answers[
|
| 84 |
-
gross_weight = answers[
|
| 85 |
-
tare_weight = answers[
|
| 86 |
-
net_weight = answers[
|
| 87 |
-
moisture = answers[
|
| 88 |
-
damage = answers[
|
| 89 |
-
gross_units = answers[
|
| 90 |
-
dock_units = answers[
|
| 91 |
-
comment = answers[
|
| 92 |
-
assembly_number = answers[
|
| 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
|