Update app.py
Browse files
app.py
CHANGED
|
@@ -94,6 +94,7 @@ def parse_po_items_with_filters(text):
|
|
| 94 |
current_item["Unit"] = qty_match.group(2)
|
| 95 |
else:
|
| 96 |
print(f"No Qty match found in line: {line}") # Debugging
|
|
|
|
| 97 |
|
| 98 |
# Match Unit Price and Total Price
|
| 99 |
price_match = re.search(price_pattern, line)
|
|
@@ -103,6 +104,8 @@ def parse_po_items_with_filters(text):
|
|
| 103 |
current_item["Total Price"] = price_match.group("TotalPrice")
|
| 104 |
else:
|
| 105 |
print(f"No price match found in line: {line}") # Debugging
|
|
|
|
|
|
|
| 106 |
|
| 107 |
# Finalize the last item
|
| 108 |
if current_item is not None:
|
|
@@ -199,5 +202,6 @@ def create_gradio_interface():
|
|
| 199 |
)
|
| 200 |
|
| 201 |
if __name__ == "__main__":
|
|
|
|
| 202 |
interface = create_gradio_interface()
|
| 203 |
interface.launch()
|
|
|
|
| 94 |
current_item["Unit"] = qty_match.group(2)
|
| 95 |
else:
|
| 96 |
print(f"No Qty match found in line: {line}") # Debugging
|
| 97 |
+
current_item["Qty"] = "Not Found" # Default if no match
|
| 98 |
|
| 99 |
# Match Unit Price and Total Price
|
| 100 |
price_match = re.search(price_pattern, line)
|
|
|
|
| 104 |
current_item["Total Price"] = price_match.group("TotalPrice")
|
| 105 |
else:
|
| 106 |
print(f"No price match found in line: {line}") # Debugging
|
| 107 |
+
current_item["Unit Price"] = "Not Found"
|
| 108 |
+
current_item["Total Price"] = "Not Found"
|
| 109 |
|
| 110 |
# Finalize the last item
|
| 111 |
if current_item is not None:
|
|
|
|
| 202 |
)
|
| 203 |
|
| 204 |
if __name__ == "__main__":
|
| 205 |
+
# Launch the Gradio interface
|
| 206 |
interface = create_gradio_interface()
|
| 207 |
interface.launch()
|