Spaces:
Sleeping
Sleeping
Consoli Sergio
commited on
Commit
·
af1a9ea
1
Parent(s):
3ef0463
updated faceted browser with sparql query
Browse files- app-demo-myMultiNER.py +16 -5
app-demo-myMultiNER.py
CHANGED
|
@@ -170,7 +170,10 @@ def get_urls(word, df_annotated_combined):
|
|
| 170 |
urls.insert(0, firsturlinlist)
|
| 171 |
|
| 172 |
#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])
|
| 173 |
-
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])
|
|
|
|
|
|
|
|
|
|
| 174 |
return html_links
|
| 175 |
return ""
|
| 176 |
|
|
@@ -609,10 +612,15 @@ def nerBio(text, ModelsSelection, CategoriesSelection, ScoreFilt, EntityLinking,
|
|
| 609 |
# if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
| 610 |
# 'word']
|
| 611 |
# ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
lambda row: (
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
),
|
| 617 |
axis=1
|
| 618 |
)
|
|
@@ -740,7 +748,10 @@ def update_urls(selected_word, state):
|
|
| 740 |
|
| 741 |
# Convert list of URLs to HTML string with clickable links
|
| 742 |
#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])
|
| 743 |
-
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])
|
|
|
|
|
|
|
|
|
|
| 744 |
return html_links
|
| 745 |
return ""
|
| 746 |
else:
|
|
|
|
| 170 |
urls.insert(0, firsturlinlist)
|
| 171 |
|
| 172 |
#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])
|
| 173 |
+
#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])
|
| 174 |
+
html_links = "<br>".join(
|
| 175 |
+
[f'<a href="https://api-vast.jrc.service.ec.europa.eu/sparql?default-graph-uri=&query=DESCRIBE+<{url}>&format=text/html" target="_blank">{url}</a>' for
|
| 176 |
+
url in urls])
|
| 177 |
return html_links
|
| 178 |
return ""
|
| 179 |
|
|
|
|
| 612 |
# if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
| 613 |
# 'word']
|
| 614 |
# ),
|
| 615 |
+
#lambda row: (
|
| 616 |
+
# f"<a href='https://api-vast.jrc.service.ec.europa.eu/describe//?url={row['namedEntity']}' target='_blank'>{row['word']}</a>"
|
| 617 |
+
# if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
| 618 |
+
# 'word']
|
| 619 |
+
#),
|
| 620 |
lambda row: (
|
| 621 |
+
f"<a href='https://api-vast.jrc.service.ec.europa.eu/sparql?default-graph-uri=&query=DESCRIBE+<{row['namedEntity']}>&format=text/html' target='_blank'>{row['word']}</a>"
|
| 622 |
+
if row['namedEntity'] not in [None, '', 'NaN', 'nan'] and pd.notnull(row['namedEntity']) else row[
|
| 623 |
+
'word']
|
| 624 |
),
|
| 625 |
axis=1
|
| 626 |
)
|
|
|
|
| 748 |
|
| 749 |
# Convert list of URLs to HTML string with clickable links
|
| 750 |
#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])
|
| 751 |
+
#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])
|
| 752 |
+
html_links = "<br>".join([f'<a href="https://api-vast.jrc.service.ec.europa.eu/sparql?default-graph-uri=&query=DESCRIBE+<{url}>&format=text/html" target="_blank">{url}</a>'
|
| 753 |
+
for url in urls])
|
| 754 |
+
|
| 755 |
return html_links
|
| 756 |
return ""
|
| 757 |
else:
|