paul hilders commited on
Commit
be112ad
1 Parent(s): f0f4f09
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -82,6 +82,7 @@ def NER_demo(image, text):
82
  # for each named entity.
83
  highlighed_entities = []
84
  for ent in nlp(text).ents:
 
85
  ent_text = ent.text
86
  ent_label = ent.label_
87
  highlighed_entities.append((ent_text, 1.0))
@@ -96,19 +97,19 @@ outputs_NER = ["text"]
96
 
97
 
98
  iface_NER = gr.Interface(fn=NER_demo,
99
- inputs=inputs_NER,
100
- outputs=outputs_NER,
101
- examples=[["example_images/London.png", "London Eye"],
102
- ["example_images/London.png", "Big Ben"],
103
- ["example_images/harrypotter.png", "Harry"],
104
- ["example_images/harrypotter.png", "Hermione"],
105
- ["example_images/harrypotter.png", "Ron"],
106
- ["example_images/Amsterdam.png", "Amsterdam canal"],
107
- ["example_images/Amsterdam.png", "Old buildings"],
108
- ["example_images/Amsterdam.png", "Pink flowers"],
109
- ["example_images/dogs_on_bed.png", "Two dogs"],
110
- ["example_images/dogs_on_bed.png", "Book"],
111
- ["example_images/dogs_on_bed.png", "Cat"]])
112
 
113
 
114
  demo_tabs = gr.TabbedInterface([iface, iface_NER], ["Default", "NER"])
 
82
  # for each named entity.
83
  highlighed_entities = []
84
  for ent in nlp(text).ents:
85
+ print(ent)
86
  ent_text = ent.text
87
  ent_label = ent.label_
88
  highlighed_entities.append((ent_text, 1.0))
 
97
 
98
 
99
  iface_NER = gr.Interface(fn=NER_demo,
100
+ inputs=inputs_NER,
101
+ outputs=outputs_NER,
102
+ examples=[["example_images/London.png", "London Eye"],
103
+ ["example_images/London.png", "Big Ben"],
104
+ ["example_images/harrypotter.png", "Harry"],
105
+ ["example_images/harrypotter.png", "Hermione"],
106
+ ["example_images/harrypotter.png", "Ron"],
107
+ ["example_images/Amsterdam.png", "Amsterdam canal"],
108
+ ["example_images/Amsterdam.png", "Old buildings"],
109
+ ["example_images/Amsterdam.png", "Pink flowers"],
110
+ ["example_images/dogs_on_bed.png", "Two dogs"],
111
+ ["example_images/dogs_on_bed.png", "Book"],
112
+ ["example_images/dogs_on_bed.png", "Cat"]])
113
 
114
 
115
  demo_tabs = gr.TabbedInterface([iface, iface_NER], ["Default", "NER"])