rajistics commited on
Commit
4d457ef
β€’
1 Parent(s): f0ccd65

almost there

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -75,10 +75,10 @@ def process_image(image):
75
  font = ImageFont.load_default()
76
  for prediction, box in zip(true_predictions, true_boxes):
77
  predicted_label = iob_to_label(prediction) #.lower()
78
- print (predicted_label)
79
- print (label2color[predicted_label])
80
- #draw.rectangle(box, outline=label2color[predicted_label])
81
- #draw.text((box[0]+10, box[1]-10), text=predicted_label, fill=label2color[predicted_label], font=font)
82
 
83
  return image
84
 
@@ -86,7 +86,7 @@ def process_image(image):
86
  title = "Interactive demo: LayoutLMv3"
87
  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, a dataset of ***. It annotates the words appearing in the image as ***. To use it, simply upload an image or use the example image below and click 'Submit'. Results will show up in a few seconds. If you want to make the output bigger, right-click on it and select 'Open image in new tab'."
88
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2204.08387' target='_blank'>LayoutLMv3: Multi-modal Pre-training for Visually-Rich Document Understanding</a> | <a href='https://github.com/microsoft/unilm' target='_blank'>Github Repo</a></p>"
89
- examples =[['test0.jpeg','./test1.jpeg','test2.jpeg']]
90
 
91
  css = ".output-image, .input-image {height: 40rem !important; width: 100% !important;}"
92
  #css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"
 
75
  font = ImageFont.load_default()
76
  for prediction, box in zip(true_predictions, true_boxes):
77
  predicted_label = iob_to_label(prediction) #.lower()
78
+ #print (predicted_label)
79
+ #print (label2color[predicted_label])
80
+ draw.rectangle(box, outline=label2color[predicted_label])
81
+ draw.text((box[0]+10, box[1]-10), text=predicted_label, fill=label2color[predicted_label], font=font)
82
 
83
  return image
84
 
 
86
  title = "Interactive demo: LayoutLMv3"
87
  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, a dataset of ***. It annotates the words appearing in the image as ***. To use it, simply upload an image or use the example image below and click 'Submit'. Results will show up in a few seconds. If you want to make the output bigger, right-click on it and select 'Open image in new tab'."
88
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2204.08387' target='_blank'>LayoutLMv3: Multi-modal Pre-training for Visually-Rich Document Understanding</a> | <a href='https://github.com/microsoft/unilm' target='_blank'>Github Repo</a></p>"
89
+ examples =[['test0.jpeg'],['./test1.jpeg'],['test2.jpeg']]
90
 
91
  css = ".output-image, .input-image {height: 40rem !important; width: 100% !important;}"
92
  #css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"