jinhybr commited on
Commit
251afb3
·
1 Parent(s): a95107b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -29,7 +29,7 @@ model = AutoModelForTokenClassification.from_pretrained("jinhybr/OCR-LayoutLMv3"
29
 
30
  # load image example
31
  dataset = load_dataset("nielsr/funsd-layoutlmv3", split="test")
32
- image = Image.open(dataset[0]["image_path"]).convert("RGB")
33
  image = Image.open("./example_lm3.png")
34
  image.save("document.jpg")
35
  # define id2label, label2color
@@ -37,6 +37,20 @@ labels = dataset.features['ner_tags'].feature.names
37
  id2label = {v: k for v, k in enumerate(labels)}
38
  label2color = {'question':'blue', 'answer':'green', 'header':'orange', 'other':'violet'}
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  def unnormalize_box(bbox, width, height):
41
  return [
42
  width * (bbox[0] / 1000),
 
29
 
30
  # load image example
31
  dataset = load_dataset("nielsr/funsd-layoutlmv3", split="test")
32
+ image = Image.open(dataset[0]).convert("RGB")
33
  image = Image.open("./example_lm3.png")
34
  image.save("document.jpg")
35
  # define id2label, label2color
 
37
  id2label = {v: k for v, k in enumerate(labels)}
38
  label2color = {'question':'blue', 'answer':'green', 'header':'orange', 'other':'violet'}
39
 
40
+
41
+
42
+ #####
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
  def unnormalize_box(bbox, width, height):
55
  return [
56
  width * (bbox[0] / 1000),