Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,6 @@ from utils import get_ist_time
|
|
4 |
|
5 |
def process_image(image):
|
6 |
try:
|
7 |
-
print("📸 Image received:", type(image)) # Debug log
|
8 |
-
|
9 |
if image is None:
|
10 |
return "No image provided", "-", None, "-"
|
11 |
|
@@ -19,12 +17,11 @@ def process_image(image):
|
|
19 |
return f"{weight} g (Confidence: {confidence}%)", timestamp, image, log_url
|
20 |
|
21 |
except Exception as e:
|
22 |
-
print("❌ Error in process_image:", str(e)) # Debug log
|
23 |
return f"Error: {str(e)}", "-", None, "-"
|
24 |
|
25 |
iface = gr.Interface(
|
26 |
fn=process_image,
|
27 |
-
inputs=gr.Image(type="pil", label="Upload or Capture Snapshot"
|
28 |
outputs=[
|
29 |
gr.Textbox(label="Detected Weight"),
|
30 |
gr.Textbox(label="Captured At (IST)"),
|
@@ -37,4 +34,4 @@ iface = gr.Interface(
|
|
37 |
)
|
38 |
|
39 |
if __name__ == "__main__":
|
40 |
-
iface.launch()
|
|
|
4 |
|
5 |
def process_image(image):
|
6 |
try:
|
|
|
|
|
7 |
if image is None:
|
8 |
return "No image provided", "-", None, "-"
|
9 |
|
|
|
17 |
return f"{weight} g (Confidence: {confidence}%)", timestamp, image, log_url
|
18 |
|
19 |
except Exception as e:
|
|
|
20 |
return f"Error: {str(e)}", "-", None, "-"
|
21 |
|
22 |
iface = gr.Interface(
|
23 |
fn=process_image,
|
24 |
+
inputs=gr.Image(type="pil", label="Upload or Capture Snapshot"),
|
25 |
outputs=[
|
26 |
gr.Textbox(label="Detected Weight"),
|
27 |
gr.Textbox(label="Captured At (IST)"),
|
|
|
34 |
)
|
35 |
|
36 |
if __name__ == "__main__":
|
37 |
+
iface.launch()
|