Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,15 @@ def process_image(image):
|
|
6 |
try:
|
7 |
if image is None:
|
8 |
return "No image provided", "-", None, "-"
|
9 |
-
|
10 |
weight, confidence = extract_weight_from_image(image)
|
11 |
timestamp = get_ist_time()
|
12 |
|
13 |
if not weight:
|
14 |
return "No weight detected", timestamp, image, "-"
|
15 |
|
16 |
-
|
17 |
-
return f"{weight} g (Confidence: {confidence}%)", timestamp, image,
|
18 |
|
19 |
except Exception as e:
|
20 |
return f"Error: {str(e)}", "-", None, "-"
|
@@ -29,7 +29,7 @@ iface = gr.Interface(
|
|
29 |
gr.Textbox(label="Salesforce Log URL"),
|
30 |
],
|
31 |
title="⚖️ Auto Weight Logger",
|
32 |
-
description="Upload or capture a digital scale
|
33 |
live=True,
|
34 |
)
|
35 |
|
|
|
6 |
try:
|
7 |
if image is None:
|
8 |
return "No image provided", "-", None, "-"
|
9 |
+
|
10 |
weight, confidence = extract_weight_from_image(image)
|
11 |
timestamp = get_ist_time()
|
12 |
|
13 |
if not weight:
|
14 |
return "No weight detected", timestamp, image, "-"
|
15 |
|
16 |
+
sf_url = f"https://your-salesforce-site.com/log-weight?weight={weight}&time={timestamp}"
|
17 |
+
return f"{weight} g (Confidence: {confidence}%)", timestamp, image, sf_url
|
18 |
|
19 |
except Exception as e:
|
20 |
return f"Error: {str(e)}", "-", None, "-"
|
|
|
29 |
gr.Textbox(label="Salesforce Log URL"),
|
30 |
],
|
31 |
title="⚖️ Auto Weight Logger",
|
32 |
+
description="Upload or capture a digital scale image to extract the weight.",
|
33 |
live=True,
|
34 |
)
|
35 |
|