Spaces:
Runtime error
Runtime error
Commit
Β·
2570fea
1
Parent(s):
2258a42
Switching from interface to blocks
Browse files
app.py
CHANGED
|
@@ -38,12 +38,27 @@ description = "A simple Gradio interface to query receipts using RAG"
|
|
| 38 |
examples = [["data/receipt_00000.JPG", 7.7],
|
| 39 |
["data/receipt_00001.jpg", 7.7]]
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
demo.launch()
|
|
|
|
| 38 |
examples = [["data/receipt_00000.JPG", 7.7],
|
| 39 |
["data/receipt_00001.jpg", 7.7]]
|
| 40 |
|
| 41 |
+
with gr.Blocks() as demo:
|
| 42 |
+
gr.Markdown(f"# {title}\n{description}")
|
| 43 |
+
image = gr.Image(width=320, height=320, label="Input Receipt")
|
| 44 |
+
width_ths = gr.Slider(0, 10, 7.7, 0.1, label="Width Threshold to merge bounding boxes")
|
| 45 |
+
|
| 46 |
+
ocr_out = gr.Textbox(label="OCR Output", type="text")
|
| 47 |
+
|
| 48 |
+
submit_btn = gr.Button("Submit")
|
| 49 |
+
clear_btn = gr.ClearButton("Clear")
|
| 50 |
+
|
| 51 |
+
submit_btn.click(inference, inputs=[image, width_ths], outputs=ocr_out)
|
| 52 |
+
clear_btn.click(lambda: [None, 7.7], outputs=ocr_out)
|
| 53 |
+
|
| 54 |
+
examples_obj = gr.Examples(examples=examples, inputs=[image, width_ths])
|
| 55 |
+
|
| 56 |
+
# demo = gr.Interface(inference,
|
| 57 |
+
# inputs = [gr.Image(width=320, height=320, label="Input Receipt"),
|
| 58 |
+
# gr.Slider(0, 10, 7.7, 0.1, label="Width Threshold to merge bounding boxes")],
|
| 59 |
+
# outputs= [gr.Textbox(label="OCR Output", type="text")],
|
| 60 |
+
# title=title,
|
| 61 |
+
# description=description,
|
| 62 |
+
# examples=examples)
|
| 63 |
|
| 64 |
demo.launch()
|