gopichandra commited on
Commit
6bf8ec2
·
verified ·
1 Parent(s): 135066f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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
- # Normalize text and match against product names
125
  best_match, score = process.extractOne(text, PRODUCT_NAMES)
126
- if score >= 80: # Match threshold
 
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