Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,9 +53,7 @@ def parse_ticket_image(image, question):
|
|
| 53 |
|
| 54 |
# Define questions you want to ask the model
|
| 55 |
|
| 56 |
-
questions = [
|
| 57 |
-
{"question": "What is the ticket number?", "context": document}
|
| 58 |
-
]
|
| 59 |
#{"question": "What is the type of grain (For example: corn, soy, wheat)?", "context": image},
|
| 60 |
#{"question": "What is the date?", "context": image},
|
| 61 |
#{"question": "What is the time?", "context": image},
|
|
@@ -76,12 +74,11 @@ def parse_ticket_image(image, question):
|
|
| 76 |
answers = {}
|
| 77 |
for q in questions:
|
| 78 |
answer_text = process_question(q, document)
|
| 79 |
-
answers[
|
| 80 |
|
| 81 |
|
| 82 |
-
|
| 83 |
# Extract answers from the results
|
| 84 |
-
ticket_number = answers["What is the ticket number?"]
|
| 85 |
#ticket_number = results[0][0]['answer']
|
| 86 |
#date = results[1][0]['answer']
|
| 87 |
#time = results[2][0]['answer']
|
|
|
|
| 53 |
|
| 54 |
# Define questions you want to ask the model
|
| 55 |
|
| 56 |
+
questions = ["What is the ticket number?"]
|
|
|
|
|
|
|
| 57 |
#{"question": "What is the type of grain (For example: corn, soy, wheat)?", "context": image},
|
| 58 |
#{"question": "What is the date?", "context": image},
|
| 59 |
#{"question": "What is the time?", "context": image},
|
|
|
|
| 74 |
answers = {}
|
| 75 |
for q in questions:
|
| 76 |
answer_text = process_question(q, document)
|
| 77 |
+
answers[i] = answer_text
|
| 78 |
|
| 79 |
|
| 80 |
+
ticket_number = answers[0]
|
| 81 |
# Extract answers from the results
|
|
|
|
| 82 |
#ticket_number = results[0][0]['answer']
|
| 83 |
#date = results[1][0]['answer']
|
| 84 |
#time = results[2][0]['answer']
|