stephenhage commited on
Commit
a14091f
1 Parent(s): 8120568

added entity recognition

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -2,9 +2,13 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
 
5
 
6
- def greet(article, max_length=130, min_length=30, do_sample=False):
7
  return summarizer(article, max_length, min_length, do_sample)
8
 
9
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
10
  iface.launch()
 
2
  from transformers import pipeline
3
 
4
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
5
+ ner = pipeline("ner", aggregation_strategy="simple")
6
 
7
+ def make_summary(article, max_length=130, min_length=30, do_sample=False):
8
  return summarizer(article, max_length, min_length, do_sample)
9
 
10
+ def get_entities(article):
11
+ return ner(article)
12
+
13
+ iface = gr.Interface(fn=[make_summary, get_entities], inputs="text", outputs="text")
14
  iface.launch()