mp-02 commited on
Commit
4452340
1 Parent(s): 7baebb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -6,19 +6,19 @@ import json
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
- j, 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
- image = image_blurred.copy()
13
- j2, image_final = cord_prediction(image)
14
 
15
  #we then link the two json files
16
- if len(d) == 0:
17
  j3 = j2
18
  else:
19
- j3 = json.dumps(j).split('}')[0] + ', ' + json.dumps(j2).split('{')[1]
20
 
21
- return j, image_blurred, j2, image_final, j3
22
 
23
 
24
  title = "Interactive demo: LayoutLMv3 for receipts"
 
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:
19
+ j3 = json.dumps(j1).split('}')[0] + ', ' + json.dumps(j2).split('{')[1]
20
 
21
+ return j1, image_blurred, j2, image_final, j3
22
 
23
 
24
  title = "Interactive demo: LayoutLMv3 for receipts"