Update app.py
Browse files
app.py
CHANGED
|
@@ -291,9 +291,11 @@ def gemini_context_correction(text):
|
|
| 291 |
f"Additionally, extract the MRP (e.g., 'MRP: ₹99.00', 'Rs. 99/-'). "
|
| 292 |
f"Format the output as:\n"
|
| 293 |
f"Manufacturing Date: <MFG Date> Expiration Date: <EXP Date> MRP: <MRP Value>"
|
|
|
|
| 294 |
f"Here is the text: {text}"
|
| 295 |
)
|
| 296 |
|
|
|
|
| 297 |
return response.text
|
| 298 |
|
| 299 |
|
|
@@ -1014,6 +1016,9 @@ def create_ocr_interface():
|
|
| 1014 |
detect_and_ocr,
|
| 1015 |
inputs=[input_image],
|
| 1016 |
outputs=[output_image, extracted_textbox, refined_textbox, validated_textbox]
|
|
|
|
|
|
|
|
|
|
| 1017 |
)
|
| 1018 |
|
| 1019 |
# Update the table when validated_textbox changes
|
|
@@ -1039,7 +1044,7 @@ def create_ocr_interface():
|
|
| 1039 |
|
| 1040 |
further_button.click(
|
| 1041 |
lambda: gr.update(visible=False),
|
| 1042 |
-
outputs=[
|
| 1043 |
)
|
| 1044 |
|
| 1045 |
return ocr_interface
|
|
|
|
| 291 |
f"Additionally, extract the MRP (e.g., 'MRP: ₹99.00', 'Rs. 99/-'). "
|
| 292 |
f"Format the output as:\n"
|
| 293 |
f"Manufacturing Date: <MFG Date> Expiration Date: <EXP Date> MRP: <MRP Value>"
|
| 294 |
+
f"Do **not** generate example text or assumptions."
|
| 295 |
f"Here is the text: {text}"
|
| 296 |
)
|
| 297 |
|
| 298 |
+
|
| 299 |
return response.text
|
| 300 |
|
| 301 |
|
|
|
|
| 1016 |
detect_and_ocr,
|
| 1017 |
inputs=[input_image],
|
| 1018 |
outputs=[output_image, extracted_textbox, refined_textbox, validated_textbox]
|
| 1019 |
+
).then(
|
| 1020 |
+
lambda: gr.update(visible=True), # Show detail_table
|
| 1021 |
+
outputs=[detail_table]
|
| 1022 |
)
|
| 1023 |
|
| 1024 |
# Update the table when validated_textbox changes
|
|
|
|
| 1044 |
|
| 1045 |
further_button.click(
|
| 1046 |
lambda: gr.update(visible=False),
|
| 1047 |
+
outputs=[detail_table]
|
| 1048 |
)
|
| 1049 |
|
| 1050 |
return ocr_interface
|