Sanjayraju30 commited on
Commit
a3a81c9
·
verified ·
1 Parent(s): f76d417

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,4 +1,4 @@
1
-
2
  import gradio as gr
3
  from PIL import Image
4
  from datetime import datetime
@@ -27,10 +27,10 @@ def process_image(image):
27
  ist = pytz.timezone('Asia/Kolkata')
28
  timestamp = datetime.now(ist).strftime("%Y-%m-%d %H:%M:%S IST")
29
 
30
- if not weight or ("No valid" in weight and "OCR:" not in weight):
31
- return "❌ Unable to detect. Try again with a clearer image.", "", image, gr.update(visible=True)
32
 
33
- numeric_match = re.search(r'\d{1,5}(?:\.\d{1,3})?', weight)
34
  if not numeric_match:
35
  return "❌ Could not extract number", "", image, gr.update(visible=True)
36
 
 
1
+ # app.py
2
  import gradio as gr
3
  from PIL import Image
4
  from datetime import datetime
 
27
  ist = pytz.timezone('Asia/Kolkata')
28
  timestamp = datetime.now(ist).strftime("%Y-%m-%d %H:%M:%S IST")
29
 
30
+ if not weight or ("No valid" in weight and "OCR:" in weight):
31
+ return f"❌ OCR Failed: {weight}", "", image, gr.update(visible=True)
32
 
33
+ numeric_match = re.search(r'\d{1,5}(\.\d{1,3})?', weight)
34
  if not numeric_match:
35
  return "❌ Could not extract number", "", image, gr.update(visible=True)
36