Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,10 +102,8 @@ def match_product_name(extracted_text, threshold=70):
|
|
| 102 |
best_match = None
|
| 103 |
best_score = 0
|
| 104 |
|
| 105 |
-
print("Matching Process:") # Debugging: Print matching process
|
| 106 |
for line in extracted_text.split("\n"):
|
| 107 |
match, score = process.extractOne(line, PRODUCT_NAMES)
|
| 108 |
-
print(f"Line: {line}, Match: {match}, Score: {score}") # Debugging: Print each line and its match score
|
| 109 |
if score > best_score:
|
| 110 |
best_match = match
|
| 111 |
best_score = score
|
|
@@ -279,8 +277,6 @@ def process_image(image, mode, entry_type, quantity, threshold=70):
|
|
| 279 |
if not extracted_text:
|
| 280 |
return "No text detected in the image.", None, None
|
| 281 |
|
| 282 |
-
print("Extracted Text:", extracted_text) # Debugging: Print extracted text
|
| 283 |
-
|
| 284 |
product_name = match_product_name(extracted_text, threshold)
|
| 285 |
attributes = extract_attributes(extracted_text)
|
| 286 |
if product_name:
|
|
|
|
| 102 |
best_match = None
|
| 103 |
best_score = 0
|
| 104 |
|
|
|
|
| 105 |
for line in extracted_text.split("\n"):
|
| 106 |
match, score = process.extractOne(line, PRODUCT_NAMES)
|
|
|
|
| 107 |
if score > best_score:
|
| 108 |
best_match = match
|
| 109 |
best_score = score
|
|
|
|
| 277 |
if not extracted_text:
|
| 278 |
return "No text detected in the image.", None, None
|
| 279 |
|
|
|
|
|
|
|
| 280 |
product_name = match_product_name(extracted_text, threshold)
|
| 281 |
attributes = extract_attributes(extracted_text)
|
| 282 |
if product_name:
|