cache
Browse files
demo.py
CHANGED
@@ -20,18 +20,26 @@ import streamlit as st
|
|
20 |
|
21 |
# Load from huggingface
|
22 |
# sm = spacy.load('en_core_web_sm', disable=['ner'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
nlp = spacy.load("en_engagement_RoBERTa_combined")
|
24 |
|
25 |
doc = nlp(
|
26 |
'Welcome! Probably this is one of the few attempts to teach a machine how to read the discourse...! Although it is not perfect, you should be able to get a good place to start for your stance-taking analyses. The result will be presented here.'
|
27 |
)
|
28 |
|
29 |
-
TPL_ENT = """
|
30 |
-
<mark class="entity" style="background: {bg}; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;">
|
31 |
-
|
32 |
-
|
33 |
-
</mark>
|
34 |
-
"""
|
35 |
|
36 |
TPL_SPANS = """
|
37 |
<div class="spans" style="line-height: 4.5;">
|
@@ -64,13 +72,13 @@ TPL_SPAN_START = """
|
|
64 |
|
65 |
"""
|
66 |
|
67 |
-
TPL_SPAN_START_RTL = """
|
68 |
-
<span style="background: {bg}; top: {top_offset}px; height: 4px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; left: -1px; width: calc(100% + 2px); position: absolute;">
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
</span>
|
73 |
-
"""
|
74 |
|
75 |
DEFAULT_TEXT = """Tickner said regardless of the result, the royal commission was a waste of money and he would proceed with a separate inquiry into the issue headed by Justice Jane Matthews. His attack came as the Aboriginal women involved in the case demanded a female minister examine the religious beliefs they claim are inherent in their fight against a bridge to the island near Goolwa in South Australia."""
|
76 |
|
|
|
20 |
|
21 |
# Load from huggingface
|
22 |
# sm = spacy.load('en_core_web_sm', disable=['ner'])
|
23 |
+
|
24 |
+
|
25 |
+
@st.cache(allow_output_mutation=True)
|
26 |
+
def load_model(spacy_model):
|
27 |
+
nlp = spacy.load("en_engagement_RoBERTa_combined")
|
28 |
+
return (nlp)
|
29 |
+
|
30 |
+
|
31 |
nlp = spacy.load("en_engagement_RoBERTa_combined")
|
32 |
|
33 |
doc = nlp(
|
34 |
'Welcome! Probably this is one of the few attempts to teach a machine how to read the discourse...! Although it is not perfect, you should be able to get a good place to start for your stance-taking analyses. The result will be presented here.'
|
35 |
)
|
36 |
|
37 |
+
# TPL_ENT = """
|
38 |
+
# <mark class="entity" style="background: {bg}; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;">
|
39 |
+
# {text}
|
40 |
+
# <span style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem">{label}</span>
|
41 |
+
# </mark>
|
42 |
+
# """
|
43 |
|
44 |
TPL_SPANS = """
|
45 |
<div class="spans" style="line-height: 4.5;">
|
|
|
72 |
|
73 |
"""
|
74 |
|
75 |
+
# TPL_SPAN_START_RTL = """
|
76 |
+
# <span style="background: {bg}; top: {top_offset}px; height: 4px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; left: -1px; width: calc(100% + 2px); position: absolute;">
|
77 |
+
# <span style="background: {bg}; z-index: 10; color: #000; top: -0.5em; padding: 2px 3px; position: absolute; font-size: 0.6em; font-weight: bold; line-height: 1; border-radius: 3px">
|
78 |
+
# {label}{kb_link}
|
79 |
+
# </span>
|
80 |
+
# </span>
|
81 |
+
# """
|
82 |
|
83 |
DEFAULT_TEXT = """Tickner said regardless of the result, the royal commission was a waste of money and he would proceed with a separate inquiry into the issue headed by Justice Jane Matthews. His attack came as the Aboriginal women involved in the case demanded a female minister examine the religious beliefs they claim are inherent in their fight against a bridge to the island near Goolwa in South Australia."""
|
84 |
|