Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
|
|
| 8 |
|
| 9 |
modeL_NER = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
| 10 |
|
| 11 |
-
#Now,
|
| 12 |
|
| 13 |
nlp = pipeline("ner", model=modeL_NER, tokenizer=tokenizer)
|
| 14 |
|
|
@@ -17,8 +17,7 @@ text_NER=st.text_input("This is meant for Named Entity Recognition (NER) tasks:
|
|
| 17 |
#Now, apply model results
|
| 18 |
|
| 19 |
ner_results = nlp(text_NER)
|
| 20 |
-
|
| 21 |
-
st.write(item)
|
| 22 |
|
| 23 |
|
| 24 |
#Now, we work on text summarization (TS)
|
|
@@ -46,6 +45,9 @@ results = summarizer(ARTICLE, max_length=130, min_length=30, do_sample=False)
|
|
| 46 |
|
| 47 |
#Now let’s see the results.
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
st.write(results[0]["summary_text"])
|
| 50 |
|
| 51 |
|
|
|
|
| 8 |
|
| 9 |
modeL_NER = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
|
| 10 |
|
| 11 |
+
#Now, create a pipeline using the above
|
| 12 |
|
| 13 |
nlp = pipeline("ner", model=modeL_NER, tokenizer=tokenizer)
|
| 14 |
|
|
|
|
| 17 |
#Now, apply model results
|
| 18 |
|
| 19 |
ner_results = nlp(text_NER)
|
| 20 |
+
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
#Now, we work on text summarization (TS)
|
|
|
|
| 45 |
|
| 46 |
#Now let’s see the results.
|
| 47 |
|
| 48 |
+
for item in ner_results:
|
| 49 |
+
st.write(item)
|
| 50 |
+
|
| 51 |
st.write(results[0]["summary_text"])
|
| 52 |
|
| 53 |
|