Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,8 @@ def process_document(image,sendimg):
|
|
34 |
im1 = Image.fromarray(image)
|
35 |
elif sendimg == False:
|
36 |
im1 = Image.open('./no_image.jpg')
|
|
|
|
|
37 |
|
38 |
#send notification through telegram
|
39 |
TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
|
@@ -85,6 +87,8 @@ paragraph3 = '<p><strong>Benchmark observations:</strong><br />From all document
|
|
85 |
paragraph4 = '<p><strong>Try it out:</strong><br />To use it, simply upload your image and click 'submit', or click one of the examples to load them.<br /><em>(because this is running on the free cpu tier, it will take about 40 secs before you see a result. On a GPU it takes less than 2 seconds)</em></p><p> </p><p>Have fun 😎</p><p>Toon Beerten</p>'
|
86 |
smallprint = '<p>✤ <span style="font-size:11px">To get an idea of the usage, you can opt to let me get personally notified via Telegram with the image uploaded. All data will be automatically deleted after 48 hours</span></p>'
|
87 |
css = "#inp {height: auto !important; width: 100% !important;}"
|
|
|
|
|
88 |
# css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"
|
89 |
# css = ".output_image, .input_image {height: 600px !important}"
|
90 |
|
@@ -123,6 +127,8 @@ with gr.Blocks(css=css) as demo:
|
|
123 |
btn.click(fn=process_document, inputs=[inp,sendimg], outputs=[jsonout,imgout])
|
124 |
|
125 |
gr.HTML(smallprint)
|
|
|
|
|
126 |
|
127 |
demo.launch()
|
128 |
|
|
|
34 |
im1 = Image.fromarray(image)
|
35 |
elif sendimg == False:
|
36 |
im1 = Image.open('./no_image.jpg')
|
37 |
+
#keep track of demo count
|
38 |
+
resp = requests.get('https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fto-be%2Finvoice_document_headers_extraction_with_donut%2Fdemo&label=demos%20served&labelColor=%23edd239&countColor=%23d9e3f0')
|
39 |
|
40 |
#send notification through telegram
|
41 |
TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
|
|
|
87 |
paragraph4 = '<p><strong>Try it out:</strong><br />To use it, simply upload your image and click 'submit', or click one of the examples to load them.<br /><em>(because this is running on the free cpu tier, it will take about 40 secs before you see a result. On a GPU it takes less than 2 seconds)</em></p><p> </p><p>Have fun 😎</p><p>Toon Beerten</p>'
|
88 |
smallprint = '<p>✤ <span style="font-size:11px">To get an idea of the usage, you can opt to let me get personally notified via Telegram with the image uploaded. All data will be automatically deleted after 48 hours</span></p>'
|
89 |
css = "#inp {height: auto !important; width: 100% !important;}"
|
90 |
+
visit_badge = '<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fto-be%2Finvoice_document_headers_extraction_with_donut"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fto-be%2Finvoice_document_headers_extraction_with_donut&labelColor=%23edd239&countColor=%23d9e3f0&style=flat" /></a>'
|
91 |
+
|
92 |
# css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"
|
93 |
# css = ".output_image, .input_image {height: 600px !important}"
|
94 |
|
|
|
127 |
btn.click(fn=process_document, inputs=[inp,sendimg], outputs=[jsonout,imgout])
|
128 |
|
129 |
gr.HTML(smallprint)
|
130 |
+
gr.HTML(visit_badge)
|
131 |
+
|
132 |
|
133 |
demo.launch()
|
134 |
|