Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,10 @@
|
|
| 1 |
-
"""
|
| 2 |
-
#* make sure to run the application using this commmand:
|
| 3 |
-
>>> streamlit run main.py
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
# global
|
| 7 |
import streamlit as st
|
| 8 |
from lime.lime_text import LimeTextExplainer
|
| 9 |
from nltk.corpus import stopwords
|
| 10 |
|
| 11 |
-
# local
|
| 12 |
from deployment_utils import DataPreparator, Predictor, generate_random_sample, generate_highlighted_words, extract_case_information
|
| 13 |
|
| 14 |
|
| 15 |
-
# instantiate `DataPreparator` & `Predictor` objects
|
| 16 |
data_preparator = DataPreparator()
|
| 17 |
predictor = Predictor()
|
| 18 |
eng_stop_words = stopwords.words("english")
|
|
@@ -22,7 +14,6 @@ st.set_page_config(
|
|
| 22 |
page_icon="🧊",
|
| 23 |
layout="wide")
|
| 24 |
|
| 25 |
-
# for custom CSS styling
|
| 26 |
with open("./src/style.css") as f:
|
| 27 |
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
| 28 |
|
|
@@ -106,18 +97,9 @@ with right_col:
|
|
| 106 |
|
| 107 |
option = st.selectbox(
|
| 108 |
"Select Model",
|
| 109 |
-
("
|
| 110 |
-
"LSTM", "FastText", "Ensemble (Doc2Vec + TF-IDF)")
|
| 111 |
)
|
| 112 |
|
| 113 |
-
# if `Get Random Sample` btn is pressed
|
| 114 |
-
# if get_random_case_button:
|
| 115 |
-
# random_petitioner, random_respondent, random_facts, random_label = generate_random_sample()
|
| 116 |
-
# st.session_state["petitioner"] = random_petitioner.strip()
|
| 117 |
-
# st.session_state["respondent"] = random_respondent.strip()
|
| 118 |
-
# st.session_state["facts"] = random_facts.strip()
|
| 119 |
-
# st.success(f"Original label: {random_label}")
|
| 120 |
-
|
| 121 |
col1, col2 = st.columns(2)
|
| 122 |
|
| 123 |
with col1:
|
|
@@ -248,7 +230,7 @@ with right_col:
|
|
| 248 |
|
| 249 |
else:
|
| 250 |
st.warning(
|
| 251 |
-
"Sadly, this feature is not supported in BERT
|
| 252 |
|
| 253 |
else:
|
| 254 |
st.error("Please, fill in all fields!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from lime.lime_text import LimeTextExplainer
|
| 3 |
from nltk.corpus import stopwords
|
| 4 |
|
|
|
|
| 5 |
from deployment_utils import DataPreparator, Predictor, generate_random_sample, generate_highlighted_words, extract_case_information
|
| 6 |
|
| 7 |
|
|
|
|
| 8 |
data_preparator = DataPreparator()
|
| 9 |
predictor = Predictor()
|
| 10 |
eng_stop_words = stopwords.words("english")
|
|
|
|
| 14 |
page_icon="🧊",
|
| 15 |
layout="wide")
|
| 16 |
|
|
|
|
| 17 |
with open("./src/style.css") as f:
|
| 18 |
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
| 19 |
|
|
|
|
| 97 |
|
| 98 |
option = st.selectbox(
|
| 99 |
"Select Model",
|
| 100 |
+
("CNN","BERT","Doc2Vec")
|
|
|
|
| 101 |
)
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
col1, col2 = st.columns(2)
|
| 104 |
|
| 105 |
with col1:
|
|
|
|
| 230 |
|
| 231 |
else:
|
| 232 |
st.warning(
|
| 233 |
+
"Sadly, this feature is not supported in BERT")
|
| 234 |
|
| 235 |
else:
|
| 236 |
st.error("Please, fill in all fields!")
|