Update app.py
Browse files
app.py
CHANGED
@@ -26,8 +26,7 @@ craft = Craft(output_dir=None,
|
|
26 |
|
27 |
|
28 |
# load image examples from the IAM database
|
29 |
-
urls = ['https://
|
30 |
-
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRNYtTuSBpZPV_nkBYPMFwVVD9asZOPgHww4epu9EqWgDmXW--sE2o8og40ZfDGo87j5w&usqp=CAU']
|
31 |
for idx, url in enumerate(urls):
|
32 |
image = Image.open(requests.get(url, stream=True).raw)
|
33 |
image.save(f"image_{idx}.png")
|
@@ -63,7 +62,7 @@ def process_image(image):
|
|
63 |
title = "Interactive demo: TrOCR"
|
64 |
description = "Demo for Microsoft's TrOCR, an encoder-decoder model consisting of an image Transformer encoder and a text Transformer decoder for state-of-the-art optical character recognition (OCR) on single-text line images. This particular model is fine-tuned on IAM, a dataset of annotated handwritten images. To use it, simply upload an image or use the example image below and click 'submit'. Results will show up in a few seconds."
|
65 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2109.10282'>TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models</a> | <a href='https://github.com/microsoft/unilm/tree/master/trocr'>Github Repo</a></p>"
|
66 |
-
examples =[["image_0.png"]
|
67 |
|
68 |
iface = gr.Interface(fn=process_image,
|
69 |
inputs=gr.inputs.Image(type="pil"),
|
|
|
26 |
|
27 |
|
28 |
# load image examples from the IAM database
|
29 |
+
urls = ['https://cdn.shopify.com/s/files/1/0275/6457/2777/files/Penwritten_2048x.jpg']
|
|
|
30 |
for idx, url in enumerate(urls):
|
31 |
image = Image.open(requests.get(url, stream=True).raw)
|
32 |
image.save(f"image_{idx}.png")
|
|
|
62 |
title = "Interactive demo: TrOCR"
|
63 |
description = "Demo for Microsoft's TrOCR, an encoder-decoder model consisting of an image Transformer encoder and a text Transformer decoder for state-of-the-art optical character recognition (OCR) on single-text line images. This particular model is fine-tuned on IAM, a dataset of annotated handwritten images. To use it, simply upload an image or use the example image below and click 'submit'. Results will show up in a few seconds."
|
64 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2109.10282'>TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models</a> | <a href='https://github.com/microsoft/unilm/tree/master/trocr'>Github Repo</a></p>"
|
65 |
+
examples =[["image_0.png"]]
|
66 |
|
67 |
iface = gr.Interface(fn=process_image,
|
68 |
inputs=gr.inputs.Image(type="pil"),
|