rayl-aoit commited on
Commit
2226656
·
verified ·
1 Parent(s): b2ae370

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -11
app.py CHANGED
@@ -129,18 +129,43 @@ with playground:
129
  outputs=[summary_textbox, translated_textbox])
130
 
131
  with gr.TabItem("Name Entity"):
132
- gr.Markdown("""
133
- > Name Entity Recognition
134
- """)
135
-
136
- iface = gr.Interface(fn=ner,
137
- inputs=[gr.Textbox(label="Text to find entities", lines=2)],
138
- outputs=[gr.HighlightedText(label="Text with entities")],
139
- title="NER with dslim/bert-base-NER",
140
- description="Find entities using the `dslim/bert-base-NER` model!",
141
- allow_flagging="never",
142
- examples=["My name is Ray, I'm learning through Hugging Face and DeepLearning.AI and I live in Caversham, Reading", "My name is Raymond, I work at A&O IT Group"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
 
144
 
145
  create_playground_footer()
146
 
 
129
  outputs=[summary_textbox, translated_textbox])
130
 
131
  with gr.TabItem("Name Entity"):
132
+ # gr.Markdown("""
133
+ # > Name Entity Recognition
134
+ # """)
135
+
136
+ # iface = gr.Interface(fn=ner,
137
+ # inputs=[gr.Textbox(label="Text to find entities", lines=2)],
138
+ # outputs=[gr.HighlightedText(label="Text with entities")],
139
+ # title="NER with dslim/bert-base-NER",
140
+ # description="Find entities using the `dslim/bert-base-NER` model!",
141
+ # allow_flagging="never",
142
+ # examples=["My name is Ray, I'm learning through Hugging Face and DeepLearning.AI and I live in Caversham, Reading", "My name is Raymond, I work at A&O IT Group"])
143
+
144
+ gr.Markdown("# NER with dslim/bert-base-NER")
145
+ gr.Markdown("Find entities using the `dslim/bert-base-NER` model!")
146
+ with gr.Row():
147
+ with gr.Column(scale=4):
148
+ gr.Markdown("""
149
+ ## Find entities
150
+ ### Entities involved Name, Organization, and Location.
151
+ > pipeline: ner, model: [dslim/bert-base-NER](https://huggingface.co/dslim/bert-base-NER)
152
+ """)
153
+
154
+ with gr.Column(scale=1):
155
+ ner_pipeline_button = gr.Button(value="Process")
156
+
157
+ with gr.Row():
158
+ with gr.Column():
159
+ ner_text_input = gr.Textbox(label="Text to find entities", lines=2)
160
+ examples = gr.Examples(examples=[
161
+ "My name is Ray, I'm learning through Hugging Face and DeepLearning.AI and I live in Caversham, Reading",
162
+ "My name is Raymond, I work at A&O IT Group"
163
+ ], inputs=ner_text_input)
164
+
165
+ with gr.Column():
166
+ ner_text_output = gr.HighlightedText(label="Text with entities")
167
 
168
+ ner_pipeline_button.click(ner, inputs=ner_text_input, outputs=ner_text_output)
169
 
170
  create_playground_footer()
171