Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,17 +12,18 @@ def process_image(img):
|
|
| 12 |
return f"{weight} g (Confidence: {confidence}%)", ist_time, img
|
| 13 |
|
| 14 |
with gr.Blocks(title="βοΈ Auto Weight Logger") as demo:
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
image_input = gr.Image(type="pil", label="π· Upload or Capture Image")
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
|
|
|
|
|
|
| 23 |
snapshot = gr.Image(label="πΈ Snapshot Image")
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
demo.launch()
|
|
|
|
| 12 |
return f"{weight} g (Confidence: {confidence}%)", ist_time, img
|
| 13 |
|
| 14 |
with gr.Blocks(title="βοΈ Auto Weight Logger") as demo:
|
| 15 |
+
gr.Markdown("# βοΈ Auto Weight Logger")
|
| 16 |
+
gr.Markdown("Upload or capture an image of the digital scale display to extract the weight using OCR.")
|
|
|
|
| 17 |
|
| 18 |
+
with gr.Row():
|
| 19 |
+
image_input = gr.Image(type="pil", label="π· Upload or Capture Image")
|
| 20 |
+
output_weight = gr.Textbox(label="βοΈ Detected Weight")
|
| 21 |
|
| 22 |
+
with gr.Row():
|
| 23 |
+
timestamp = gr.Textbox(label="π Captured At (IST)")
|
| 24 |
snapshot = gr.Image(label="πΈ Snapshot Image")
|
| 25 |
|
| 26 |
+
submit = gr.Button("π Detect Weight")
|
| 27 |
+
submit.click(process_image, inputs=image_input, outputs=[output_weight, timestamp, snapshot])
|
| 28 |
|
| 29 |
demo.launch()
|