Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
adding analytics
Browse files- pages/1_π·_Label_Clause_Demo.py +5 -0
- pages/2_π·_Label_Contract_Demo.py +5 -0
- pages/3_β_Extract_Demo.py +6 -1
- pages/4_π_Compare_Demo.py +6 -15
- pages/5_π_Organise_Demo.py +8 -1
- pages/6_π_Find_Demo.py +8 -1
- pages/7_βοΈ_Draft_Demo.py +8 -1
- pages/8_π_Summarise_Demo.py +8 -1
- requirements.txt +1 -0
- π‘_Home.py +7 -0
pages/1_π·_Label_Clause_Demo.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import joblib
|
3 |
|
4 |
import plotly.graph_objects as go
|
|
|
5 |
|
6 |
from huggingface_hub import hf_hub_download
|
7 |
|
@@ -20,6 +21,8 @@ EXAMPLE_TEXT = """This Agreement and any dispute or claim arising out of or in c
|
|
20 |
or its subject matter or formation (including non-contractual disputes or claims) shall be
|
21 |
governed by and construed in accordance with the law of England."""
|
22 |
|
|
|
|
|
23 |
## Layout stuff
|
24 |
st.set_page_config(
|
25 |
page_title="Label Clause Demo",
|
@@ -98,3 +101,5 @@ if button:
|
|
98 |
components.html(exp.as_html(predict_proba=False), height=600)
|
99 |
|
100 |
add_footer()
|
|
|
|
|
|
2 |
import joblib
|
3 |
|
4 |
import plotly.graph_objects as go
|
5 |
+
import streamlit_analytics
|
6 |
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
|
|
|
21 |
or its subject matter or formation (including non-contractual disputes or claims) shall be
|
22 |
governed by and construed in accordance with the law of England."""
|
23 |
|
24 |
+
streamlit_analytics.start_tracking()
|
25 |
+
|
26 |
## Layout stuff
|
27 |
st.set_page_config(
|
28 |
page_title="Label Clause Demo",
|
|
|
101 |
components.html(exp.as_html(predict_proba=False), height=600)
|
102 |
|
103 |
add_footer()
|
104 |
+
|
105 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
pages/2_π·_Label_Contract_Demo.py
CHANGED
@@ -3,6 +3,7 @@ import joblib
|
|
3 |
|
4 |
import plotly.graph_objects as go
|
5 |
|
|
|
6 |
import streamlit as st
|
7 |
import streamlit.components.v1 as components
|
8 |
|
@@ -44,6 +45,8 @@ Specific information disclosed as part of the Confidential Information shall not
|
|
44 |
ADURO BIOTECH, INC. CONSULTANT
|
45 |
By: /s/ Stephen T. Isaacs By: /s/ Andrea van Elsas Name: Stephen T. Isaacs Name: Andrea van Elsas Title: President and Chief Executive Officer Title: Chief Scientific Officer"""
|
46 |
|
|
|
|
|
47 |
## Layout stuff
|
48 |
st.set_page_config(
|
49 |
page_title="Label Contract Demo",
|
@@ -124,3 +127,5 @@ if button:
|
|
124 |
components.html(exp.as_html(predict_proba=False), height=600)
|
125 |
|
126 |
add_footer()
|
|
|
|
|
|
3 |
|
4 |
import plotly.graph_objects as go
|
5 |
|
6 |
+
import streamlit_analytics
|
7 |
import streamlit as st
|
8 |
import streamlit.components.v1 as components
|
9 |
|
|
|
45 |
ADURO BIOTECH, INC. CONSULTANT
|
46 |
By: /s/ Stephen T. Isaacs By: /s/ Andrea van Elsas Name: Stephen T. Isaacs Name: Andrea van Elsas Title: President and Chief Executive Officer Title: Chief Scientific Officer"""
|
47 |
|
48 |
+
streamlit_analytics.start_tracking()
|
49 |
+
|
50 |
## Layout stuff
|
51 |
st.set_page_config(
|
52 |
page_title="Label Contract Demo",
|
|
|
127 |
components.html(exp.as_html(predict_proba=False), height=600)
|
128 |
|
129 |
add_footer()
|
130 |
+
|
131 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
pages/3_β_Extract_Demo.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import re
|
3 |
|
|
|
4 |
from huggingface_hub import snapshot_download
|
5 |
|
6 |
import streamlit as st
|
@@ -25,6 +26,8 @@ by and between Global Technologies, Ltd (hereinafter the "Company"),
|
|
25 |
a Delaware corporation whose address is 501 1st Ave N., Suite 901, St. Petersburg, FL 33701 and Timothy Cabrera (hereinafter the "Consultant"),
|
26 |
an individual whose address is 11718 SE Federal Hwy., Suite 372, Hobe Sound, FL 33455 (individually, a "Party"; collectively, the "Parties")."""
|
27 |
|
|
|
|
|
28 |
## Layout stuff
|
29 |
st.set_page_config(
|
30 |
page_title="Extract Demo",
|
@@ -188,4 +191,6 @@ if button:
|
|
188 |
|
189 |
st.table(df)
|
190 |
|
191 |
-
add_footer()
|
|
|
|
|
|
1 |
import os
|
2 |
import re
|
3 |
|
4 |
+
import streamlit_analytics
|
5 |
from huggingface_hub import snapshot_download
|
6 |
|
7 |
import streamlit as st
|
|
|
26 |
a Delaware corporation whose address is 501 1st Ave N., Suite 901, St. Petersburg, FL 33701 and Timothy Cabrera (hereinafter the "Consultant"),
|
27 |
an individual whose address is 11718 SE Federal Hwy., Suite 372, Hobe Sound, FL 33455 (individually, a "Party"; collectively, the "Parties")."""
|
28 |
|
29 |
+
streamlit_analytics.start_tracking()
|
30 |
+
|
31 |
## Layout stuff
|
32 |
st.set_page_config(
|
33 |
page_title="Extract Demo",
|
|
|
191 |
|
192 |
st.table(df)
|
193 |
|
194 |
+
add_footer()
|
195 |
+
|
196 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
pages/4_π_Compare_Demo.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import difflib
|
3 |
import spacy
|
|
|
4 |
|
5 |
from utils import add_logo_to_sidebar, add_footer
|
6 |
|
@@ -9,6 +10,7 @@ from utils import add_logo_to_sidebar, add_footer
|
|
9 |
def load_model():
|
10 |
return spacy.load('en_core_web_md')
|
11 |
|
|
|
12 |
|
13 |
## Layout stuff
|
14 |
st.set_page_config(
|
@@ -26,9 +28,7 @@ st.set_page_config(
|
|
26 |
add_logo_to_sidebar()
|
27 |
|
28 |
st.title('π Compare Demo')
|
29 |
-
st.write("""
|
30 |
-
This demo shows how AI can be used to compare passages of text.
|
31 |
-
""")
|
32 |
st.write("**π Enter two passages of text on the left** and hit the button **Compare** to see the demo in action")
|
33 |
|
34 |
with st.spinner('βοΈ Loading model...'):
|
@@ -107,16 +107,6 @@ if button:
|
|
107 |
with col2:
|
108 |
st.markdown(create_str_output(doc_2, doc_2_token_idxs))
|
109 |
|
110 |
-
doc_1_tag_idxs, doc_2_tag_idxs = get_matching_idxs(get_pos_tags(doc_1), get_pos_tags(doc_2))
|
111 |
-
|
112 |
-
st.markdown('We can highlight the :green[similarities] and :red[differences] in **syntax** across the two texts.')
|
113 |
-
col1, col2 = st.columns(2)
|
114 |
-
with col1:
|
115 |
-
st.markdown(create_str_output(doc_1, doc_1_tag_idxs))
|
116 |
-
with col2:
|
117 |
-
st.markdown(create_str_output(doc_2, doc_2_tag_idxs))
|
118 |
-
|
119 |
-
|
120 |
col1, col2, col3 = st.columns(3)
|
121 |
|
122 |
with col1:
|
@@ -128,8 +118,7 @@ if button:
|
|
128 |
|
129 |
with col2:
|
130 |
st.subheader('π Linguistic Similarity')
|
131 |
-
st.markdown(
|
132 |
-
'We can measure the similarity based on the *linguistic features* of the two texts.')
|
133 |
postags_1 = [token.pos_ for token in doc_1]
|
134 |
postags_2 = [token.pos_ for token in doc_2]
|
135 |
sm = difflib.SequenceMatcher(None, postags_1, postags_2)
|
@@ -141,3 +130,5 @@ if button:
|
|
141 |
st.metric(label='Semantic Similarity', value=f"{doc_1.similarity(doc_2) * 100:.1f}%")
|
142 |
|
143 |
add_footer()
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import difflib
|
3 |
import spacy
|
4 |
+
import streamlit_analytics
|
5 |
|
6 |
from utils import add_logo_to_sidebar, add_footer
|
7 |
|
|
|
10 |
def load_model():
|
11 |
return spacy.load('en_core_web_md')
|
12 |
|
13 |
+
streamlit_analytics.start_tracking()
|
14 |
|
15 |
## Layout stuff
|
16 |
st.set_page_config(
|
|
|
28 |
add_logo_to_sidebar()
|
29 |
|
30 |
st.title('π Compare Demo')
|
31 |
+
st.write("""This demo shows how AI can be used to compare passages of text.""")
|
|
|
|
|
32 |
st.write("**π Enter two passages of text on the left** and hit the button **Compare** to see the demo in action")
|
33 |
|
34 |
with st.spinner('βοΈ Loading model...'):
|
|
|
107 |
with col2:
|
108 |
st.markdown(create_str_output(doc_2, doc_2_token_idxs))
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
col1, col2, col3 = st.columns(3)
|
111 |
|
112 |
with col1:
|
|
|
118 |
|
119 |
with col2:
|
120 |
st.subheader('π Linguistic Similarity')
|
121 |
+
st.markdown('We can measure the similarity based on the *linguistic features* of the two texts.')
|
|
|
122 |
postags_1 = [token.pos_ for token in doc_1]
|
123 |
postags_2 = [token.pos_ for token in doc_2]
|
124 |
sm = difflib.SequenceMatcher(None, postags_1, postags_2)
|
|
|
130 |
st.metric(label='Semantic Similarity', value=f"{doc_1.similarity(doc_2) * 100:.1f}%")
|
131 |
|
132 |
add_footer()
|
133 |
+
|
134 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
pages/5_π_Organise_Demo.py
CHANGED
@@ -1,6 +1,11 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
3 |
|
|
|
|
|
4 |
st.set_page_config(
|
5 |
page_title="Organise Demo",
|
6 |
page_icon="π",
|
@@ -21,4 +26,6 @@ st.markdown("π This demo is under construction. Please visit back soon.")
|
|
21 |
|
22 |
add_email_signup_form()
|
23 |
|
24 |
-
add_footer()
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
import streamlit as st
|
4 |
+
import streamlit_analytics
|
5 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
6 |
|
7 |
+
streamlit_analytics.start_tracking()
|
8 |
+
|
9 |
st.set_page_config(
|
10 |
page_title="Organise Demo",
|
11 |
page_icon="π",
|
|
|
26 |
|
27 |
add_email_signup_form()
|
28 |
|
29 |
+
add_footer()
|
30 |
+
|
31 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
pages/6_π_Find_Demo.py
CHANGED
@@ -1,6 +1,11 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
3 |
|
|
|
|
|
4 |
st.set_page_config(
|
5 |
page_title="Find Demo",
|
6 |
page_icon="π",
|
@@ -21,4 +26,6 @@ st.markdown("π This demo is currently under construction. Please visit back s
|
|
21 |
|
22 |
add_email_signup_form()
|
23 |
|
24 |
-
add_footer()
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
import streamlit as st
|
4 |
+
import streamlit_analytics
|
5 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
6 |
|
7 |
+
streamlit_analytics.start_tracking()
|
8 |
+
|
9 |
st.set_page_config(
|
10 |
page_title="Find Demo",
|
11 |
page_icon="π",
|
|
|
26 |
|
27 |
add_email_signup_form()
|
28 |
|
29 |
+
add_footer()
|
30 |
+
|
31 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
pages/7_βοΈ_Draft_Demo.py
CHANGED
@@ -1,6 +1,11 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
3 |
|
|
|
|
|
4 |
st.set_page_config(
|
5 |
page_title="Draft Demo",
|
6 |
page_icon="βοΈ",
|
@@ -21,4 +26,6 @@ st.markdown("π This demo is currently under construction. Please visit back s
|
|
21 |
|
22 |
add_email_signup_form()
|
23 |
|
24 |
-
add_footer()
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
import streamlit as st
|
4 |
+
import streamlit_analytics
|
5 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
6 |
|
7 |
+
streamlit_analytics.start_tracking()
|
8 |
+
|
9 |
st.set_page_config(
|
10 |
page_title="Draft Demo",
|
11 |
page_icon="βοΈ",
|
|
|
26 |
|
27 |
add_email_signup_form()
|
28 |
|
29 |
+
add_footer()
|
30 |
+
|
31 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
pages/8_π_Summarise_Demo.py
CHANGED
@@ -1,6 +1,11 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
3 |
|
|
|
|
|
4 |
st.set_page_config(
|
5 |
page_title="Summarise Demo",
|
6 |
page_icon="π",
|
@@ -21,4 +26,6 @@ st.markdown("π This demo is currently under construction. Please visit back s
|
|
21 |
|
22 |
add_email_signup_form()
|
23 |
|
24 |
-
add_footer()
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
import streamlit as st
|
4 |
+
import streamlit_analytics
|
5 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
6 |
|
7 |
+
streamlit_analytics.start_tracking()
|
8 |
+
|
9 |
st.set_page_config(
|
10 |
page_title="Summarise Demo",
|
11 |
page_icon="π",
|
|
|
26 |
|
27 |
add_email_signup_form()
|
28 |
|
29 |
+
add_footer()
|
30 |
+
|
31 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|
requirements.txt
CHANGED
@@ -50,6 +50,7 @@ spacy==3.5.1
|
|
50 |
https://huggingface.co/spacy/en_core_web_md/resolve/main/en_core_web_md-any-py3-none-any.whl
|
51 |
smmap==5.0.0
|
52 |
streamlit==1.20.0
|
|
|
53 |
threadpoolctl==3.1.0
|
54 |
toml==0.10.2
|
55 |
toolz==0.12.0
|
|
|
50 |
https://huggingface.co/spacy/en_core_web_md/resolve/main/en_core_web_md-any-py3-none-any.whl
|
51 |
smmap==5.0.0
|
52 |
streamlit==1.20.0
|
53 |
+
streamlit-analytics==0.4.1
|
54 |
threadpoolctl==3.1.0
|
55 |
toml==0.10.2
|
56 |
toolz==0.12.0
|
π‘_Home.py
CHANGED
@@ -1,7 +1,12 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
4 |
|
|
|
|
|
5 |
st.set_page_config(
|
6 |
page_title="Legal AI Demos",
|
7 |
page_icon="π",
|
@@ -70,3 +75,5 @@ st.markdown(
|
|
70 |
)
|
71 |
|
72 |
add_footer()
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
import streamlit as st
|
4 |
+
import streamlit_analytics
|
5 |
|
6 |
from utils import add_logo_to_sidebar, add_footer, add_email_signup_form
|
7 |
|
8 |
+
streamlit_analytics.start_tracking()
|
9 |
+
|
10 |
st.set_page_config(
|
11 |
page_title="Legal AI Demos",
|
12 |
page_icon="π",
|
|
|
75 |
)
|
76 |
|
77 |
add_footer()
|
78 |
+
|
79 |
+
streamlit_analytics.stop_tracking(unsafe_password=os.environ["ANALYTICS_PASSWORD"])
|