mp-02 commited on
Commit
9a891af
1 Parent(s): 47ed111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -5,14 +5,15 @@ import json
5
 
6
  def prediction(image):
7
 
8
- #we first use mp-02/layoutlmv3-finetuned-cord on the image, which gives us a JSON with some info and a blurred image
 
9
  j1, image_blurred = sroie_prediction(image)
10
 
11
- #then we use the model fine-tuned on sroie (for now it is Theivaprakasham/layoutlmv3-finetuned-sroie)
12
  img = image_blurred.copy()
13
  j2, image_final = cord_prediction(img)
14
 
15
- #we then link the two json files
16
  if len(j1) == 0:
17
  j3 = j2
18
  else:
@@ -22,8 +23,8 @@ def prediction(image):
22
 
23
 
24
  title = "Interactive demo: LayoutLMv3 for receipts"
25
- description = "Demo for Microsoft's LayoutLMv3, a Transformer for state-of-the-art document image understanding tasks. This particular model is fine-tuned on CORD and SROIE, which are datasets of receipts.\n It firsts uses the fine-tune on SROIE to extract date, company and address, then the fine-tune on CORD for the other info.\n To use it, simply upload an image or use the example image below. Results will show up in a few seconds."
26
- examples = [['image.jpeg']]
27
 
28
  css = """.output_image, .input_image {height: 600px !important}"""
29
 
 
5
 
6
  def prediction(image):
7
 
8
+ # we first use the model fine-tuned on sroie (for now it is Theivaprakasham/layoutlmv3-finetuned-sroie)
9
+ # on the image, which gives us a JSON with some info and we blur the corresponding boxes
10
  j1, image_blurred = sroie_prediction(image)
11
 
12
+ # then we use the model fine-tuned on cord on the blurred image
13
  img = image_blurred.copy()
14
  j2, image_final = cord_prediction(img)
15
 
16
+ # link the two json files
17
  if len(j1) == 0:
18
  j3 = j2
19
  else:
 
23
 
24
 
25
  title = "Interactive demo: LayoutLMv3 for receipts"
26
+ description = "Demo for Microsoft's LayoutLMv3, a Transformer for state-of-the-art document image understanding tasks. This particular space uses two instances of the model, one fine-tuned on CORD and the other SROIE.\n It firsts uses the fine-tune on SROIE to extract date, company and address, then the fine-tune on CORD for the other info. To use it, simply upload an image or use the example image below. Results will show up in a few seconds."
27
+ examples = [['image.jpeg']['image.png']]
28
 
29
  css = """.output_image, .input_image {height: 600px !important}"""
30