Spaces:
Runtime error
Runtime error
add markdown to gradio
Browse files- gradio_ner.py +31 -1
gradio_ner.py
CHANGED
@@ -84,9 +84,39 @@ def ner(text):
|
|
84 |
output = ner_pipeline(text)
|
85 |
return {"text": text, "entities": output}
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
88 |
gr.Textbox(placeholder="Enter text here..."),
|
89 |
gr.HighlightedText(),
|
90 |
examples=examples)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
|
|
|
|
|
|
|
|
|
|
92 |
demo.launch(server_name=settings.SERVER_HOST, server_port=settings.PORT)
|
|
|
84 |
output = ner_pipeline(text)
|
85 |
return {"text": text, "entities": output}
|
86 |
|
87 |
+
css = '''
|
88 |
+
h1{margin-bottom: 0 !important}
|
89 |
+
'''
|
90 |
+
|
91 |
+
with gr.Blocks(css=css) as demo:
|
92 |
+
gr.Interface(ner,
|
93 |
gr.Textbox(placeholder="Enter text here..."),
|
94 |
gr.HighlightedText(),
|
95 |
examples=examples)
|
96 |
+
gr.Markdown("""
|
97 |
+
# Extract Legal Entities from Insurance Documents using BERT transfomers
|
98 |
+
|
99 |
+
This space use fine tuned BERT transfomers for NER of legal entities in Life Insurance demand letters.
|
100 |
+
|
101 |
+
Dataset is publicly available here
|
102 |
+
https://github.com/aws-samples/aws-legal-entity-extraction.git
|
103 |
+
|
104 |
+
The model extracts the following entities:
|
105 |
+
|
106 |
+
* Law Firm
|
107 |
+
* Law Office Address
|
108 |
+
* Insurance Company
|
109 |
+
* Insurance Company Address
|
110 |
+
* Policy Holder Name
|
111 |
+
* Beneficiary Name
|
112 |
+
* Policy Number
|
113 |
+
* Payout
|
114 |
+
* Required Action
|
115 |
+
* Sender
|
116 |
|
117 |
+
Dataset consists of legal requisition/demand letters for Life Insurance, however this approach can be used across any industry & document which may benefit from spatial data in NER training.
|
118 |
+
## Finetuning BERT Transformers model
|
119 |
+
```source/services/ner/train/train.py```
|
120 |
+
This code fine tune the BERT model and uploads to huggingface
|
121 |
+
""")
|
122 |
demo.launch(server_name=settings.SERVER_HOST, server_port=settings.PORT)
|