Spaces:
Sleeping
Sleeping
Consoli Sergio
commited on
Commit
·
eff93c6
1
Parent(s):
5a9842d
last changes and deploy it
Browse files- app-demo-myMultiNER.py +13 -13
app-demo-myMultiNER.py
CHANGED
@@ -76,8 +76,8 @@ examples = [
|
|
76 |
|
77 |
|
78 |
|
79 |
-
models_List = ["FacebookAI/xlm-roberta-large-finetuned-conll03-english", "Babelscape/wikineural-multilingual-ner", "blaze999/Medical-NER", "urchade/gliner_large-v2.1", "urchade/gliner_large_bio-v0.1", "NCBO/BioPortal" ] # "urchade/gliner_large-v2.1", "knowledgator/gliner-multitask-large-v0.5"
|
80 |
-
|
81 |
#models_List = ["NCBO/BioPortal" ]
|
82 |
|
83 |
#categories_List = ["MED","LOC","PER","ORG","DATE","MISC"]
|
@@ -168,8 +168,8 @@ def get_urls(word, df_annotated_combined):
|
|
168 |
# Insert the URL at the first position
|
169 |
urls.insert(0, firsturlinlist)
|
170 |
|
171 |
-
html_links = "<br>".join([f'<a href="https://expl-rels-dev-vast.apps.ocpt.jrc.ec.europa.eu/?concept={url}" target="_blank">{url}</a>' for url in urls])
|
172 |
-
|
173 |
return html_links
|
174 |
return ""
|
175 |
|
@@ -224,7 +224,7 @@ def nerBio(text, ModelsSelection, CategoriesSelection, ScoreFilt, EntityLinking,
|
|
224 |
help="List of ontologies to which restrict the entity linking task.")
|
225 |
#consose 20250502:
|
226 |
if Counter(KGchoices) == Counter(POSSIBLE_KGchoices_List):
|
227 |
-
parser.add_argument("--USE_CACHE", type=str, default="
|
228 |
help="whether to use cache for the NER and NEL tasks or not")
|
229 |
else:
|
230 |
#print("Lists do not have the same elements")
|
@@ -550,16 +550,16 @@ def nerBio(text, ModelsSelection, CategoriesSelection, ScoreFilt, EntityLinking,
|
|
550 |
|
551 |
# # Create a new column for the entities with links
|
552 |
df_annotated_combined['entity_with_link'] = df_annotated_combined.apply(
|
|
|
|
|
|
|
|
|
|
|
553 |
lambda row: (
|
554 |
-
f"<a href='https://
|
555 |
if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
556 |
'word']
|
557 |
),
|
558 |
-
#lambda row: (
|
559 |
-
# f"<a href='https://api-vast.jrc.service.ec.europa.eu/describe//?url={row['namedEntity']}' target='_blank'>{row['word']}</a>"
|
560 |
-
# if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
561 |
-
# 'word']
|
562 |
-
#),
|
563 |
axis=1
|
564 |
)
|
565 |
|
@@ -681,8 +681,8 @@ def update_urls(selected_word, state):
|
|
681 |
urls.insert(0, firsturlinlist)
|
682 |
|
683 |
# Convert list of URLs to HTML string with clickable links
|
684 |
-
html_links = "<br>".join([f'<a href="https://expl-rels-dev-vast.apps.ocpt.jrc.ec.europa.eu/?concept={url}" target="_blank">{url}</a>' for url in urls])
|
685 |
-
|
686 |
return html_links
|
687 |
return ""
|
688 |
|
|
|
76 |
|
77 |
|
78 |
|
79 |
+
#models_List = ["FacebookAI/xlm-roberta-large-finetuned-conll03-english", "Babelscape/wikineural-multilingual-ner", "blaze999/Medical-NER", "urchade/gliner_large-v2.1", "urchade/gliner_large_bio-v0.1", "NCBO/BioPortal" ] # "urchade/gliner_large-v2.1", "knowledgator/gliner-multitask-large-v0.5"
|
80 |
+
models_List = ["Babelscape/wikineural-multilingual-ner", "urchade/gliner_large-v2.1", "NCBO/BioPortal" ] # "urchade/gliner_large-v2.1", "knowledgator/gliner-multitask-large-v0.5"
|
81 |
#models_List = ["NCBO/BioPortal" ]
|
82 |
|
83 |
#categories_List = ["MED","LOC","PER","ORG","DATE","MISC"]
|
|
|
168 |
# Insert the URL at the first position
|
169 |
urls.insert(0, firsturlinlist)
|
170 |
|
171 |
+
#html_links = "<br>".join([f'<a href="https://expl-rels-dev-vast.apps.ocpt.jrc.ec.europa.eu/?concept={url}" target="_blank">{url}</a>' for url in urls])
|
172 |
+
html_links = "<br>".join([f'<a href="https://api-vast.jrc.service.ec.europa.eu/describe//?url={url}" target="_blank">{url}</a>' for url in urls])
|
173 |
return html_links
|
174 |
return ""
|
175 |
|
|
|
224 |
help="List of ontologies to which restrict the entity linking task.")
|
225 |
#consose 20250502:
|
226 |
if Counter(KGchoices) == Counter(POSSIBLE_KGchoices_List):
|
227 |
+
parser.add_argument("--USE_CACHE", type=str, default="False",
|
228 |
help="whether to use cache for the NER and NEL tasks or not")
|
229 |
else:
|
230 |
#print("Lists do not have the same elements")
|
|
|
550 |
|
551 |
# # Create a new column for the entities with links
|
552 |
df_annotated_combined['entity_with_link'] = df_annotated_combined.apply(
|
553 |
+
#lambda row: (
|
554 |
+
# f"<a href='https://expl-rels-dev-vast.apps.ocpt.jrc.ec.europa.eu/?concept={row['namedEntity']}' target='_blank'>{row['word']}</a>"
|
555 |
+
# if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
556 |
+
# 'word']
|
557 |
+
#),
|
558 |
lambda row: (
|
559 |
+
f"<a href='https://api-vast.jrc.service.ec.europa.eu/describe//?url={row['namedEntity']}' target='_blank'>{row['word']}</a>"
|
560 |
if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
561 |
'word']
|
562 |
),
|
|
|
|
|
|
|
|
|
|
|
563 |
axis=1
|
564 |
)
|
565 |
|
|
|
681 |
urls.insert(0, firsturlinlist)
|
682 |
|
683 |
# Convert list of URLs to HTML string with clickable links
|
684 |
+
#html_links = "<br>".join([f'<a href="https://expl-rels-dev-vast.apps.ocpt.jrc.ec.europa.eu/?concept={url}" target="_blank">{url}</a>' for url in urls])
|
685 |
+
html_links = "<br>".join([f'<a href="https://api-vast.jrc.service.ec.europa.eu/describe//?url={url}" target="_blank">{url}</a>' for url in urls])
|
686 |
return html_links
|
687 |
return ""
|
688 |
|