Sanjayraju30 commited on
Commit
121b79e
·
verified ·
1 Parent(s): 35d4bb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -13,7 +13,7 @@ def process_image(image):
13
  timestamp = datetime.now(ist).strftime("%Y-%m-%d %H:%M:%S IST")
14
 
15
  if not weight or "No valid" in weight:
16
- return "❌ Unable to detect. Try again with clearer image.", "", image, gr.update(visible=True)
17
 
18
  return weight, timestamp, image, gr.update(visible=False)
19
  except Exception as e:
@@ -22,7 +22,7 @@ def process_image(image):
22
  with gr.Blocks(css=".gr-button {background-color: #2e7d32 !important; color: white !important;}") as demo:
23
  gr.Markdown("""
24
  <h1 style='text-align: center; color: #2e7d32;'>📷 Auto Weight Logger</h1>
25
- <p style='text-align: center;'>Upload or capture a digital weight image. Detects weight using AI OCR (no Tesseract).</p>
26
  <hr style='border: 1px solid #ddd;'/>
27
  """)
28
 
@@ -41,9 +41,3 @@ with gr.Blocks(css=".gr-button {background-color: #2e7d32 !important; color: whi
41
  detect_btn.click(fn=process_image, inputs=image_input, outputs=[weight_out, time_out, snapshot, retake_btn])
42
  retake_btn.click(fn=lambda: ("", "", None, gr.update(visible=False)),
43
  inputs=[], outputs=[weight_out, time_out, snapshot, retake_btn])
44
-
45
- gr.Markdown("""
46
- <p style='text-align: center; color: gray;'>Tip: Ensure the image is clear and not blurry.<br>Developed by Shalu • Hugging Face OCR ⚡</p>
47
- """)
48
-
49
- demo.launch()
 
13
  timestamp = datetime.now(ist).strftime("%Y-%m-%d %H:%M:%S IST")
14
 
15
  if not weight or "No valid" in weight:
16
+ return "❌ Unable to detect. Try again with a clearer image.", "", image, gr.update(visible=True)
17
 
18
  return weight, timestamp, image, gr.update(visible=False)
19
  except Exception as e:
 
22
  with gr.Blocks(css=".gr-button {background-color: #2e7d32 !important; color: white !important;}") as demo:
23
  gr.Markdown("""
24
  <h1 style='text-align: center; color: #2e7d32;'>📷 Auto Weight Logger</h1>
25
+ <p style='text-align: center;'>Upload or capture a digital weight image. Detects weight using AI OCR.</p>
26
  <hr style='border: 1px solid #ddd;'/>
27
  """)
28
 
 
41
  detect_btn.click(fn=process_image, inputs=image_input, outputs=[weight_out, time_out, snapshot, retake_btn])
42
  retake_btn.click(fn=lambda: ("", "", None, gr.update(visible=False)),
43
  inputs=[], outputs=[weight_out, time_out, snapshot, retake_btn])