Thomas De Decker commited on
Commit
f92dd51
β€’
1 Parent(s): aab5966

Update space with new models + Keyphrase Extraction Pipeline fix

Browse files
app.py CHANGED
@@ -173,7 +173,7 @@ with st.form("keyphrase-extraction-form"):
173
  st.text_area(
174
  "✍ Input",
175
  st.session_state.config.get("example_text"),
176
- height=250,
177
  max_chars=2500,
178
  )
179
  .replace("\n", " ")
 
173
  st.text_area(
174
  "✍ Input",
175
  st.session_state.config.get("example_text"),
176
+ height=350,
177
  max_chars=2500,
178
  )
179
  .replace("\n", " ")
config.json CHANGED
@@ -1,11 +1,14 @@
1
  {
2
- "example_text": "Keyphrase extraction is a technique in text analysis where you extract the important keyphrases from a text. Since this is a time-consuming process, Artificial Intelligence is used to automate it. Currently, classical machine learning methods, that use statistics and linguistics, are widely used for the extraction process. The fact that these methods have been widely used in the community has the advantage that there are many easy-to-use libraries. Now with the recent innovations in NLP, transformers can be used to improve keyphrase extraction. Transformers also focus on the semantics and context of a document, which is quite an improvement.",
3
  "model_author": "ml6team",
4
  "models": [
5
  "keyphrase-extraction-kbir-inspec",
6
  "keyphrase-extraction-distilbert-inspec",
 
7
  "keyphrase-extraction-distilbert-openkp",
 
8
  "keyphrase-extraction-distilbert-kptimes",
 
9
  "keyphrase-extraction-kbir-kpcrowd",
10
  "keyphrase-generation-keybart-inspec",
11
  "keyphrase-generation-t5-small-inspec",
 
1
  {
2
+ "example_text": "Keyphrase extraction is a technique in text analysis where you extract the important keyphrases from a document. Thanks to these keyphrases humans can understand the content of a text very quickly and easily without reading it completely. Keyphrase extraction was first done primarily by human annotators, who read the text in detail and then wrote down the most important keyphrases. The disadvantage is that if you work with a lot of documents, this process can take a lot of time. Here is where Artificial Intelligence comes in. Currently, classical machine learning methods, that use statistical and linguistic features, are widely used for the extraction process. Now with deep learning, it is possible to capture the semantic meaning of a text even better than these classical methods. Classical methods look at the frequency, occurrence and order of words in the text, whereas these neural approaches can capture long-term semantic dependencies and context of words in a text.",
3
  "model_author": "ml6team",
4
  "models": [
5
  "keyphrase-extraction-kbir-inspec",
6
  "keyphrase-extraction-distilbert-inspec",
7
+ "keyphrase-extraction-kbir-openkp",
8
  "keyphrase-extraction-distilbert-openkp",
9
+ "keyphrase-extraction-kbir-kptimes",
10
  "keyphrase-extraction-distilbert-kptimes",
11
+ "keyphrase-extraction-kbir-semeval2017",
12
  "keyphrase-extraction-kbir-kpcrowd",
13
  "keyphrase-generation-keybart-inspec",
14
  "keyphrase-generation-t5-small-inspec",
pipelines/keyphrase_extraction_pipeline.py CHANGED
@@ -19,6 +19,8 @@ class KeyphraseExtractionPipeline(TokenClassificationPipeline):
19
  def postprocess(self, model_outputs):
20
  results = super().postprocess(
21
  model_outputs=model_outputs,
22
- aggregation_strategy=AggregationStrategy.SIMPLE,
 
 
23
  )
24
  return np.unique([result.get("word").strip() for result in results])
 
19
  def postprocess(self, model_outputs):
20
  results = super().postprocess(
21
  model_outputs=model_outputs,
22
+ aggregation_strategy=AggregationStrategy.SIMPLE
23
+ if self.model.config.model_type == "roberta"
24
+ else AggregationStrategy.FIRST,
25
  )
26
  return np.unique([result.get("word").strip() for result in results])