Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ def process_image(image):
|
|
12 |
ist = pytz.timezone('Asia/Kolkata')
|
13 |
timestamp = datetime.now(ist).strftime("%Y-%m-%d %H:%M:%S IST")
|
14 |
|
15 |
-
if not 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)
|
@@ -32,7 +32,7 @@ with gr.Blocks(css=".gr-button {background-color: #2e7d32 !important; color: whi
|
|
32 |
detect_btn = gr.Button("π Detect Weight")
|
33 |
|
34 |
with gr.Row():
|
35 |
-
weight_out = gr.Textbox(label="π¦ Detected Weight", placeholder="e.g.,
|
36 |
time_out = gr.Textbox(label="π Captured At (IST)", placeholder="e.g., 2025-06-30 14:32:10")
|
37 |
|
38 |
snapshot = gr.Image(label="πΈ Snapshot Preview")
|
@@ -43,7 +43,7 @@ with gr.Blocks(css=".gr-button {background-color: #2e7d32 !important; color: whi
|
|
43 |
inputs=[], outputs=[weight_out, time_out, snapshot, retake_btn])
|
44 |
|
45 |
gr.Markdown("""
|
46 |
-
<p style='text-align: center; color: gray;'>Tip: Ensure image is
|
47 |
""")
|
48 |
|
49 |
demo.launch()
|
|
|
12 |
ist = pytz.timezone('Asia/Kolkata')
|
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)
|
|
|
32 |
detect_btn = gr.Button("π Detect Weight")
|
33 |
|
34 |
with gr.Row():
|
35 |
+
weight_out = gr.Textbox(label="π¦ Detected Weight", placeholder="e.g., 97.9 kg", show_copy_button=True)
|
36 |
time_out = gr.Textbox(label="π Captured At (IST)", placeholder="e.g., 2025-06-30 14:32:10")
|
37 |
|
38 |
snapshot = gr.Image(label="πΈ Snapshot Preview")
|
|
|
43 |
inputs=[], outputs=[weight_out, time_out, snapshot, retake_btn])
|
44 |
|
45 |
gr.Markdown("""
|
46 |
+
<p style='text-align: center; color: gray;'>Tip: Ensure image is clear and flat.<br>Developed by Shalu β’ Hugging Face OCR β‘</p>
|
47 |
""")
|
48 |
|
49 |
demo.launch()
|