Spaces:
Running
Running
Update inference.py
Browse files- inference.py +9 -9
inference.py
CHANGED
@@ -68,15 +68,15 @@ def prediction(image):
|
|
68 |
if "O" in d: d.pop("O")
|
69 |
|
70 |
if("MENU.NM" in d and "MENU.PRICE" in d):
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
|
81 |
draw = ImageDraw.Draw(image, "RGBA")
|
82 |
font = ImageFont.load_default()
|
|
|
68 |
if "O" in d: d.pop("O")
|
69 |
|
70 |
if("MENU.NM" in d and "MENU.PRICE" in d):
|
71 |
+
if(len(d["MENU.NM"].split(", ")) == len(d["MENU.PRICE"].split(", "))):
|
72 |
+
menu_names = [name.strip() for name in d["MENU.NM"].split(', ')]
|
73 |
+
menu_prices = [price.strip() for price in d["MENU.PRICE"].split(', ')]
|
74 |
+
|
75 |
+
menu_combined = [{"ITEM": name, "PRICE": price} for name, price in zip(menu_names, menu_prices)]
|
76 |
+
|
77 |
+
d.pop("MENU.NM")
|
78 |
+
d.pop("MENU.PRICE")
|
79 |
+
d["MENU"] = menu_combined
|
80 |
|
81 |
draw = ImageDraw.Draw(image, "RGBA")
|
82 |
font = ImageFont.load_default()
|