Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,21 @@
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import streamlit as st
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
st.title("Basic NER model testing")
|
| 8 |
affiliation_address = st.text_input("Enter address")
|
| 9 |
if st.button("Print"):
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import streamlit as st
|
| 4 |
|
| 5 |
+
# dslim/bert-base-NER
|
| 6 |
+
# SIRIS-Lab/affilgood-NER-multilingual
|
| 7 |
+
# FacebookAI/xlm-roberta-large-finetuned-conll03-english
|
| 8 |
+
#
|
| 9 |
+
fintuned_ner_models = ["dslim/bert-base-NER", "SIRIS-Lab/affilgood-NER-multilingual", "FacebookAI/xlm-roberta-large-finetuned-conll03-english"]
|
| 10 |
+
def ner_models_result(address, models = fintuned_ner_models):
|
| 11 |
+
ner_result_entities = []
|
| 12 |
+
for model in models:
|
| 13 |
+
pipe = pipeline("ner", model=f"{model}", aggregation_strategy="simple")
|
| 14 |
+
ner_result_entities.append(pipe(address))
|
| 15 |
+
return ner_result_entities
|
| 16 |
st.title("Basic NER model testing")
|
| 17 |
affiliation_address = st.text_input("Enter address")
|
| 18 |
if st.button("Print"):
|
| 19 |
+
ner_results = ner_models_result(address = affiliation_address)
|
| 20 |
+
for result in ner_results:
|
| 21 |
+
st.write("-"*50)
|
| 22 |
+
st.write(f"Result: {result}!")
|