geethareddy commited on
Commit
04dc72d
·
verified ·
1 Parent(s): 743d772

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -96,7 +96,7 @@ def extract_weight(img):
96
  if weight:
97
  try:
98
  weight_float = float(weight)
99
- if weight_float >= 0: # Only accept valid weights
100
  confidence = 95.0 # Assume high confidence if we have a valid weight
101
  logging.info(f"Weight detected: {weight} (Confidence: {confidence:.2f}%)")
102
  return weight, confidence, processed_img
 
96
  if weight:
97
  try:
98
  weight_float = float(weight)
99
+ if weight_float >= 0 and weight_float <= 500: # Only accept reasonable weight values
100
  confidence = 95.0 # Assume high confidence if we have a valid weight
101
  logging.info(f"Weight detected: {weight} (Confidence: {confidence:.2f}%)")
102
  return weight, confidence, processed_img