Commit
·
7e788d5
1
Parent(s):
0b7c8b2
app
Browse files
app.py
CHANGED
|
@@ -18,10 +18,12 @@ ner_pipeline = pipeline(
|
|
| 18 |
|
| 19 |
def format_entities_as_html(entities):
|
| 20 |
excluded_keys = {"start", "end", "index", "word"} # Keys to exclude from the output
|
| 21 |
-
html_output = "<
|
| 22 |
|
| 23 |
for entity in entities:
|
| 24 |
-
html_output +=
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# Dynamically add all fields except the excluded ones
|
| 27 |
for key, value in entity.items():
|
|
@@ -33,9 +35,9 @@ def format_entities_as_html(entities):
|
|
| 33 |
else:
|
| 34 |
html_output += f"<strong>{key.capitalize()}:</strong> {value}<br>"
|
| 35 |
|
| 36 |
-
html_output += "</
|
| 37 |
|
| 38 |
-
html_output += "</
|
| 39 |
return html_output
|
| 40 |
|
| 41 |
|
|
|
|
| 18 |
|
| 19 |
def format_entities_as_html(entities):
|
| 20 |
excluded_keys = {"start", "end", "index", "word"} # Keys to exclude from the output
|
| 21 |
+
html_output = "<div>"
|
| 22 |
|
| 23 |
for entity in entities:
|
| 24 |
+
html_output += (
|
| 25 |
+
"<div style='margin-bottom: 10px;'>" # Each entity in a separate div
|
| 26 |
+
)
|
| 27 |
|
| 28 |
# Dynamically add all fields except the excluded ones
|
| 29 |
for key, value in entity.items():
|
|
|
|
| 35 |
else:
|
| 36 |
html_output += f"<strong>{key.capitalize()}:</strong> {value}<br>"
|
| 37 |
|
| 38 |
+
html_output += "</div>"
|
| 39 |
|
| 40 |
+
html_output += "</div>"
|
| 41 |
return html_output
|
| 42 |
|
| 43 |
|