Update app.py
Browse files
app.py
CHANGED
|
@@ -37,7 +37,7 @@ def ner(text: str, labels: str, threshold: float, nested_ner: bool):
|
|
| 37 |
with gr.Blocks(title="General NER with Color-Coded Output") as demo:
|
| 38 |
gr.Markdown(
|
| 39 |
"""
|
| 40 |
-
#
|
| 41 |
This demo selects a random text snippet from the British Library's books dataset and identifies entities using GLiNER (urchade/gliner_multi-v2.1).
|
| 42 |
"""
|
| 43 |
)
|
|
@@ -49,6 +49,7 @@ with gr.Blocks(title="General NER with Color-Coded Output") as demo:
|
|
| 49 |
placeholder="Enter your text here",
|
| 50 |
lines=5
|
| 51 |
)
|
|
|
|
| 52 |
|
| 53 |
with gr.Row() as row:
|
| 54 |
labels = gr.Textbox(
|
|
@@ -71,13 +72,13 @@ with gr.Blocks(title="General NER with Color-Coded Output") as demo:
|
|
| 71 |
label="Nested NER",
|
| 72 |
info="Enable Nested NER?",
|
| 73 |
)
|
|
|
|
| 74 |
|
| 75 |
# Define output components using HighlightedText for color-coded display
|
| 76 |
output_highlighted = gr.HighlightedText(label="Predicted Entities")
|
| 77 |
output_entities = gr.JSON(label="Entities")
|
| 78 |
|
| 79 |
-
|
| 80 |
-
refresh_btn = gr.Button("Get New Snippet")
|
| 81 |
|
| 82 |
def get_new_snippet():
|
| 83 |
attempts = 0
|
|
|
|
| 37 |
with gr.Blocks(title="General NER with Color-Coded Output") as demo:
|
| 38 |
gr.Markdown(
|
| 39 |
"""
|
| 40 |
+
# GLiNER British Library Books Demo
|
| 41 |
This demo selects a random text snippet from the British Library's books dataset and identifies entities using GLiNER (urchade/gliner_multi-v2.1).
|
| 42 |
"""
|
| 43 |
)
|
|
|
|
| 49 |
placeholder="Enter your text here",
|
| 50 |
lines=5
|
| 51 |
)
|
| 52 |
+
refresh_btn = gr.Button("Get New Snippet")
|
| 53 |
|
| 54 |
with gr.Row() as row:
|
| 55 |
labels = gr.Textbox(
|
|
|
|
| 72 |
label="Nested NER",
|
| 73 |
info="Enable Nested NER?",
|
| 74 |
)
|
| 75 |
+
submit_btn = gr.Button("Find Entities!")
|
| 76 |
|
| 77 |
# Define output components using HighlightedText for color-coded display
|
| 78 |
output_highlighted = gr.HighlightedText(label="Predicted Entities")
|
| 79 |
output_entities = gr.JSON(label="Entities")
|
| 80 |
|
| 81 |
+
|
|
|
|
| 82 |
|
| 83 |
def get_new_snippet():
|
| 84 |
attempts = 0
|