Spaces:
Running
Running
listing named entitites according to spacy
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
from interfaces.cap import demo as cap_demo
|
4 |
from interfaces.manifesto import demo as manifesto_demo
|
5 |
from interfaces.sentiment import demo as sentiment_demo
|
@@ -7,13 +8,21 @@ from interfaces.emotion import demo as emotion_demo
|
|
7 |
from interfaces.ner import demo as ner_demo
|
8 |
from interfaces.ner import download_models as download_spacy_models
|
9 |
|
|
|
|
|
|
|
|
|
10 |
with gr.Blocks() as demo:
|
11 |
gr.Markdown(
|
12 |
-
"""
|
13 |
<div style="display: block; text-align: left; padding:0; margin:0;">
|
14 |
<h1 style="text-align: center">Babel Machine Demo</h1>
|
15 |
<p>This is a demo for text classification using language models finetuned on data labeled by <a href="https://www.comparativeagendas.net/">CAP</a>, <a href="https://manifesto-project.wzb.eu/">Manifesto Project</a>, sentiment, and emotion coding systems.<br>
|
16 |
For the coding of complete datasets, please visit the official <a href="https://babel.poltextlab.com/">Babel Machine</a> site.</p>
|
|
|
|
|
|
|
|
|
17 |
</div>
|
18 |
""")
|
19 |
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from spacy import glossary
|
4 |
from interfaces.cap import demo as cap_demo
|
5 |
from interfaces.manifesto import demo as manifesto_demo
|
6 |
from interfaces.sentiment import demo as sentiment_demo
|
|
|
8 |
from interfaces.ner import demo as ner_demo
|
9 |
from interfaces.ner import download_models as download_spacy_models
|
10 |
|
11 |
+
entities = ["CARDINAL", "DATE", "EVENT", "FAC", "GPE", "LANGUAGE", "LAW", "LOC", "MONEY", "NORP", "ORDINAL", "ORG", "PERCENT", "PERSON", "PRODUCT", "QUANTITY", "TIME", "WORK_OF_ART"]
|
12 |
+
ent_dict = glossary.GLOSSARY
|
13 |
+
ent_sum = [f'{ent} = {ent_dict[ent]}' for ent in entities ]
|
14 |
+
|
15 |
with gr.Blocks() as demo:
|
16 |
gr.Markdown(
|
17 |
+
f"""
|
18 |
<div style="display: block; text-align: left; padding:0; margin:0;">
|
19 |
<h1 style="text-align: center">Babel Machine Demo</h1>
|
20 |
<p>This is a demo for text classification using language models finetuned on data labeled by <a href="https://www.comparativeagendas.net/">CAP</a>, <a href="https://manifesto-project.wzb.eu/">Manifesto Project</a>, sentiment, and emotion coding systems.<br>
|
21 |
For the coding of complete datasets, please visit the official <a href="https://babel.poltextlab.com/">Babel Machine</a> site.</p>
|
22 |
+
<p> For named entity recognition the following labels are used: </p>
|
23 |
+
<ul>
|
24 |
+
<li> {'</li> <li>'.join(ent_sum)} </li>
|
25 |
+
</ul>
|
26 |
</div>
|
27 |
""")
|
28 |
|