Spaces:
Running
Running
Commit
·
68c2783
1
Parent(s):
8c81f89
Remove post-training TensorBoard log charts
Browse files
app.py
CHANGED
@@ -88,8 +88,8 @@ def extract_fields(image_path):
|
|
88 |
return results
|
89 |
|
90 |
def extract_products(text):
|
91 |
-
#
|
92 |
-
product_pattern = r"([A-Z0-9 ]+)\
|
93 |
matches = re.findall(product_pattern, text)
|
94 |
products = [{"name": name.strip(), "price": float(price)} for name, price in matches]
|
95 |
return products
|
|
|
88 |
return results
|
89 |
|
90 |
def extract_products(text):
|
91 |
+
# This pattern matches lines like: "1076903 PISTACHIO 14.49"
|
92 |
+
product_pattern = r"\d{6,} ([A-Z0-9 ]+) (\d+\.\d{2})"
|
93 |
matches = re.findall(product_pattern, text)
|
94 |
products = [{"name": name.strip(), "price": float(price)} for name, price in matches]
|
95 |
return products
|