Spaces:
Sleeping
Sleeping
Update model_utils.py
Browse files- model_utils.py +3 -3
model_utils.py
CHANGED
|
@@ -37,10 +37,10 @@ def parse_products(raw_text):
|
|
| 37 |
match_description_mixed=re.search(r"^(.*?)(\d+)\s+[^A-Za-z0-9\s]?([\d.,]+)\s+[^A-Za-z0-9\s]?([\d.,]+)$", desc.strip())
|
| 38 |
elif match_description_mixed:
|
| 39 |
structured.append({
|
| 40 |
-
"qty":int(
|
| 41 |
"description": match_description_mixed.group(1).strip(" .:-"),
|
| 42 |
-
"unit_price": float(
|
| 43 |
-
"amount": float(
|
| 44 |
})
|
| 45 |
elif line.strip():
|
| 46 |
structured.append({
|
|
|
|
| 37 |
match_description_mixed=re.search(r"^(.*?)(\d+)\s+[^A-Za-z0-9\s]?([\d.,]+)\s+[^A-Za-z0-9\s]?([\d.,]+)$", desc.strip())
|
| 38 |
elif match_description_mixed:
|
| 39 |
structured.append({
|
| 40 |
+
"qty":int(match_description_mixed.group(2)),
|
| 41 |
"description": match_description_mixed.group(1).strip(" .:-"),
|
| 42 |
+
"unit_price": float(match_description_mixed.group(3).replace(",", "")),
|
| 43 |
+
"amount": float(match_description_mixed.group(4).replace(",", ""))
|
| 44 |
})
|
| 45 |
elif line.strip():
|
| 46 |
structured.append({
|