Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -117,13 +117,15 @@ def extract_text(image):
|
|
| 117 |
extracted_text = []
|
| 118 |
for line in result[0]:
|
| 119 |
extracted_text.append(line[1][0])
|
|
|
|
| 120 |
return "\n".join(extracted_text)
|
| 121 |
|
| 122 |
# Function to find product name from the predefined list using fuzzy matching
|
| 123 |
def match_product_name(text):
|
| 124 |
-
|
| 125 |
best_match, score = process.extractOne(text, PRODUCT_NAMES)
|
| 126 |
-
|
|
|
|
| 127 |
return best_match
|
| 128 |
return None
|
| 129 |
|
|
|
|
| 117 |
extracted_text = []
|
| 118 |
for line in result[0]:
|
| 119 |
extracted_text.append(line[1][0])
|
| 120 |
+
print("Extracted Text:", "\n".join(extracted_text)) # Debug: Log extracted text
|
| 121 |
return "\n".join(extracted_text)
|
| 122 |
|
| 123 |
# Function to find product name from the predefined list using fuzzy matching
|
| 124 |
def match_product_name(text):
|
| 125 |
+
print("Matching Text:", text) # Debug: Log the text being matched
|
| 126 |
best_match, score = process.extractOne(text, PRODUCT_NAMES)
|
| 127 |
+
print(f"Best Match: {best_match}, Score: {score}") # Debug: Log matching details
|
| 128 |
+
if score >= 70: # Lowered threshold
|
| 129 |
return best_match
|
| 130 |
return None
|
| 131 |
|