Spaces:
Runtime error
Runtime error
paul hilders
commited on
Commit
•
201e3f5
1
Parent(s):
2a64bfd
Change label
Browse files
app.py
CHANGED
@@ -78,10 +78,10 @@ iface = gr.Interface(fn=run_demo,
|
|
78 |
["example_images/dogs_on_bed.png", "Cat"]])
|
79 |
|
80 |
# NER demo:
|
81 |
-
def add_label_to_img(img):
|
82 |
-
img = ImageOps.expand(img, border=
|
83 |
draw = ImageDraw.Draw(img)
|
84 |
-
draw.text((0,0),
|
85 |
|
86 |
return img
|
87 |
|
@@ -101,7 +101,7 @@ def NER_demo(image, text):
|
|
101 |
gallery_images = [overlapped]
|
102 |
for ent_text, ent_label in highlighed_entities:
|
103 |
overlapped_ent, highlighted_text_ent = run_demo(image, ent_text)
|
104 |
-
overlapped_ent_labelled = add_label_to_img(overlapped_ent)
|
105 |
|
106 |
gallery_images.append(overlapped_ent_labelled)
|
107 |
|
|
|
78 |
["example_images/dogs_on_bed.png", "Cat"]])
|
79 |
|
80 |
# NER demo:
|
81 |
+
def add_label_to_img(img, label):
|
82 |
+
img = ImageOps.expand(img, border=45, fill=(255,255,255))
|
83 |
draw = ImageDraw.Draw(img)
|
84 |
+
draw.text((0,0), label, align="center")
|
85 |
|
86 |
return img
|
87 |
|
|
|
101 |
gallery_images = [overlapped]
|
102 |
for ent_text, ent_label in highlighed_entities:
|
103 |
overlapped_ent, highlighted_text_ent = run_demo(image, ent_text)
|
104 |
+
overlapped_ent_labelled = add_label_to_img(overlapped_ent, ent_text)
|
105 |
|
106 |
gallery_images.append(overlapped_ent_labelled)
|
107 |
|