Spaces:
Running
Running
Update app.py
Browse files
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:"
|
31 |
-
return "❌
|
32 |
|
33 |
-
numeric_match = re.search(r'\d{1,5}(
|
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 |
|