Sanjayraju30 commited on
Commit
7c5b4e0
·
verified ·
1 Parent(s): ba02b0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -4,6 +4,8 @@ from utils import get_ist_time
4
 
5
  def process_image(image):
6
  try:
 
 
7
  if image is None:
8
  return "No image provided", "-", None, "-"
9
 
@@ -17,11 +19,12 @@ def process_image(image):
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,4 +37,4 @@ iface = gr.Interface(
34
  )
35
 
36
  if __name__ == "__main__":
37
- iface.launch()
 
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
  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", tool="editor"),
28
  outputs=[
29
  gr.Textbox(label="Detected Weight"),
30
  gr.Textbox(label="Captured At (IST)"),
 
37
  )
38
 
39
  if __name__ == "__main__":
40
+ iface.launch()